When an LDL volume label has ldl_version < 0xf2, the partition
size is derived from the device size. If the device is smaller
than the partition start offset (3 blocks), the subtraction
wraps around producing a bogus partition size.
Signed-off-by: Karel Zak <kzak@redhat.com>
}
size_512 = (blocks - 3) * blocksize / 512;
} else {
- size_512 = blkid_probe_get_size(pr) / 512 - start_512;
+ uint64_t dev_512 = blkid_probe_get_size(pr) / 512;
+
+ if (dev_512 <= start_512) {
+ DBG(LOWPROBE, ul_debug("DASD LDL: device too small"));
+ return BLKID_PROBE_NONE;
+ }
+ size_512 = dev_512 - start_512;
}
DBG(LOWPROBE, ul_debug("DASD LDL: start=%"PRIu64" size=%"PRIu64" blocksize=%u",