[PATCH 7/7] kpartx: fix dos partition rollover error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



dos partitions are limited to 2^32 sectors. However these do not have to
be 512 byte sectors, which is what device-mapper tables use.  kpartx
stores the dos sectors in a 32 uint.  This means that on a 4k sector size
device with large enough partitions, when kpartx multiplies the
dos sector count by the sector size multiplier, it can rollover before
it gets stored in 64 bit slice sector count. This patch just changes the
multiplier to a 64 bit uint to match the slice sector count, and avoid
the rollover.

Signed-off-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
 kpartx/dos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kpartx/dos.c b/kpartx/dos.c
index 90ad3bd..f252d0a 100644
--- a/kpartx/dos.c
+++ b/kpartx/dos.c
@@ -79,7 +79,7 @@ read_dos_pt(int fd, struct slice all, struct slice *sp, int ns) {
 	unsigned long offset = all.start;
 	int i, n=4;
 	unsigned char *bp;
-	int sector_size_mul = get_sector_size(fd)/512;
+	uint64_t  sector_size_mul = get_sector_size(fd)/512;
 
 	bp = (unsigned char *)getblock(fd, offset);
 	if (bp == NULL)
-- 
1.8.3.1

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux