From 66d8e050ca3c243094545ce8b0e4c53d54a11715 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 18 May 2010 12:13:48 +0200 Subject: libblkid: improve MD 0.90 detection We don't have to check for collision between partition table and RAID on all RAIDs. This problem is specific to MD, where underlying device could be a partition. The RAIDs like via, intel, ... always use whole-disks only. Signed-off-by: Karel Zak --- shlibs/blkid/src/partitions/partitions.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'shlibs/blkid/src/partitions') diff --git a/shlibs/blkid/src/partitions/partitions.c b/shlibs/blkid/src/partitions/partitions.c index c670cc183..5597181a9 100644 --- a/shlibs/blkid/src/partitions/partitions.c +++ b/shlibs/blkid/src/partitions/partitions.c @@ -829,6 +829,19 @@ int blkid_probe_is_covered_by_pt(blkid_probe pr, end = (offset + size) >> 9; start = offset >> 9; + /* check if the partition table fits into the device */ + for (i = 0; i < nparts; i++) { + blkid_partition par = &ls->parts[i]; + + if (par->start + par->size > pr->size) { + DBG(DEBUG_LOWPROBE, printf("partition #%d overflows " + "device (off=%lu size=%lu)\n", + par->partno, par->start, par->size)); + goto done; + } + } + + /* check if the requested area is covered by PT */ for (i = 0; i < nparts; i++) { blkid_partition par = &ls->parts[i]; -- cgit v1.2.3-55-g7522