From: Karel Zak <kzak@redhat.com>
To: util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH] sfdisk: warn if partition starts above 2 TiB limit
Date: Fri, 1 Jul 2011 15:11:40 +0200 [thread overview]
Message-ID: <20110701131140.GQ6418@nb.net.home> (raw)
In-Reply-To: <20110701111154.GA24105@foxbat.suse.cz>
On Fri, Jul 01, 2011 at 01:11:56PM +0200, Petr Uzel wrote:
>
> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
> ---
> 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@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2011-07-01 13:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-01 11:11 [PATCH] sfdisk: warn if partition starts above 2 TiB limit Petr Uzel
2011-07-01 13:11 ` Karel Zak [this message]
2011-07-01 13:33 ` Petr Uzel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110701131140.GQ6418@nb.net.home \
--to=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox