From: Karel Zak Date: Mon, 15 Feb 2010 13:06:56 +0000 (+0100) Subject: fdisk: fix ALIGN_UP X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=faf27705fe74dc5bbe419efcf109a808b8d1d164;p=util-linux fdisk: fix ALIGN_UP Signed-off-by: Karel Zak --- diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 655bf0c6..55caa0c2 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -689,6 +689,9 @@ align_lba(unsigned long long lba, int direction) /* fprintf(stderr, "LBA: %llu apply alignment_offset\n", res); */ res -= (max(phy_sector_size, min_io_size) - alignment_offset) / sector_size; + + if (direction == ALIGN_UP && res < lba) + res += sects_in_phy; } }