From ba38276d1995b0538693445a5b65ef03c5c675df Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 5 Jul 2014 16:57:26 -0400 Subject: [PATCH] Ensure partition block size is not 0. * I tried having this test in KDiskDeviceManager.cpp, but it failed booting in one case and did not solve the problem in another. I think this is because there is an Open() call here, and that rereads the blocksize. * Tested and it solved the problem for me. * Should fix #10717 and #9489 at least. Signed-off-by: Jessica Hamilton --- .../kernel/disk_device_manager/KPartitioningSystem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp b/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp index 790028e05b..e36070d6f8 100644 --- a/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp +++ b/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp @@ -69,6 +69,11 @@ KPartitioningSystem::Identify(KPartition *partition, void **cookie) int fd = -1; if (partition->Open(O_RDONLY, &fd) != B_OK) return -1; + + // if BlockSize is 0, identify_partition will cause a KDL + if (partition->BlockSize() == 0) + return -1; + float result = fModule->identify_partition(fd, partition->PartitionData(), cookie); close(fd);