[PATCH] sfdisk: warn if partition size exceeds 2 TiB limit

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

 



From: Roberto Angelino <rangelino@xxxxxxxxxx>
Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
 fdisk/sfdisk.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 6cd85a2..4ed5d37 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1293,6 +1293,17 @@ partitions_ok(struct disk_desc *z) {
 	    }
     }
 
+    /* Are the partitions within the DOS 2TiB limit? */
+    {
+	for (p = partitions; p < partitions + partno; p++)
+	    if (p->size > (unsigned long) UINT32_MAX) {
+	        my_warn(_("Warning: partition %s of size %lu sectors exceeds "
+		          "msdos 2TiB limit\n"),
+		        PNO(p), p->size);
+	        return 0;
+	    }
+    }
+
     /* At most one chain of DOS extended partitions ? */
     /* It seems that the OS/2 fdisk has the additional requirement
        that the extended partition must be the fourth one */
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

Attachment: pgpQwlT95ijio.pgp
Description: PGP signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux