From: Karel Zak Date: Tue, 24 Jun 2014 08:32:25 +0000 (+0200) Subject: libfdisk: (dos) count fisrt usable LBA to total number of used sectors X-Git-Tag: v2.25-rc2~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11712b6667225ef6fa6b64c1fe48ed5b501ad72e;p=thirdparty%2Futil-linux.git libfdisk: (dos) count fisrt usable LBA to total number of used sectors The check() function counts number of used sectors, but it counts only partitions. This is mistake, the area before the first partition is also "used" place (boot loaders or we have to align the first partition to disk I/O limits, etc). Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index a8d4337d79..5453eb3d76 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1281,6 +1281,9 @@ static int dos_verify_disklabel(struct fdisk_context *cxt) check(cxt, i + 1, p->eh, p->es, p->ec, last[i]); total += last[i] + 1 - first[i]; + if (i == 0) + total += get_abs_partition_start(pe) - 1; + for (j = 0; j < i; j++) { if ((first[i] >= first[j] && first[i] <= last[j]) || ((last[i] <= last[j] && last[i] >= first[j]))) {