Re: [PATCH] sfdisk: warn if partition starts above 2 TiB limit

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

 



On Fri, Jul 01, 2011 at 01:11:56PM +0200, Petr Uzel wrote:
> 
> 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 4ed5d37..d498371 100644
> --- a/fdisk/sfdisk.c
> +++ b/fdisk/sfdisk.c
> @@ -1304,6 +1304,17 @@ partitions_ok(struct disk_desc *z) {
>  	    }
>      }
>  
> +    /* Do the partitions start below the DOS 2TiB limit? */
> +    {
> +	for (p = partitions; p < partitions + partno; p++)
> +	    if (p->size && p->start > (unsigned long) UINT32_MAX) {

 ULONG_MAX is not greater than UINT32_MAX on 32-bit archs ;-)

 IMHO you have to use 64-bit number for the p->size or you have 
 move the check to the place where (before) p->start is incremented.

> +	        my_warn(_("Warning: partition %s has starting sector %lu, "
> +		          "which is above the DOS 2 TiB limit\n"),

 The warning is incorrect. The limit is not 2 TiB, but UINT32_MAX
 *sectors*. It's 2TiB for 512-byte sectors, but for 4K sectors is it
 more...

 See fdisk.fdisk.c: warn_limits().

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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