[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Info-mtools] Incorrect assignment of partition type in mformat/mpartiti
From: |
Pali Rohár |
Subject: |
[Info-mtools] Incorrect assignment of partition type in mformat/mpartition |
Date: |
Sat, 11 Aug 2018 17:48:03 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
Hi!
I found out that mformat and mpartition incorrectly assigns MBR
partition type. This is because of following problems:
1) Begin and end location of partition in function setBeginEnd() is of
type "signed" integer which start overflowing when hitting 1TB partition
size. It should be "unsigned" type, it does not make sense to have
negative value. Result is that 1TB partitions are marked as FAT12
because "end-begin < 4096" is truth (end is negative number).
2) There is missing partition type for FAT32 (MBR ID 0x0C).
3) Detection expects that sector size is 512 bytes, which is not truth
for new Native 4K disks with sector size of 4096 bytes.
In attachment I'm sending a patch which fixes all these 3 problems.
I created FAT32 image with mformat -F and then via fdisk verified that
partition type is 0x0C.
--
Pali Rohár
address@hidden
mtools_partition.patch
Description: Text Data
signature.asc
Description: PGP signature
- [Info-mtools] Incorrect assignment of partition type in mformat/mpartition,
Pali Rohár <=