All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
To: util-linux <util-linux@vger.kernel.org>
Subject: Re: fdisk: off-by-one issue in (n)new command
Date: Tue, 17 Jan 2012 11:55:18 -0300	[thread overview]
Message-ID: <4F158BD6.1020006@yahoo.com.ar> (raw)
In-Reply-To: <20120117100756.GA12310@x2.net.home>

On 01/17/2012 07:07 AM, Karel Zak wrote:
> On Mon, Jan 16, 2012 at 07:30:42PM -0300, Gerardo Exequiel Pozzi wrote:
>> Last sector, +sectors or +size{K,M,G} (2048-524287, default 524287): +255M
>> Value out of range.
>   The size of the device is 268435456 bytes,
>
>   +255M is relative to the begin of the partition, it means
>
>      (2048 * 512) + (255 * 1024 * 1024) = 268435456 bytes
Right.
>
>   but the begin of the last sector (in bytes) is
>
>      268435456 - 512 = 268434944 bytes (LBA sector 524287)
>
>   Right?
Right.

 From [2048, 524287] (all inclusive), so

(524287 - 2048 + 1) * 512 = 522240  and 522240 * 512 / 2**20 = 255

Indeed, when you say, for example, these sizes: p1 = +55M, p2 = +100M, 
and now try to set +100M to p3, is not posible, so accept the default 
value, and you can see that the size is equal to p2, that is right.
So the issue appears when last sector is specified in +sectors or 
+size(K|M|G), only


-- 
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1


  reply	other threads:[~2012-01-17 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4F0E167A.9090205@yahoo.com.ar>
     [not found] ` <CAMFXF50uHCU4yhwe3byAsTKvPpi8F63mR9O4TfKhuANiEL_v0Q@mail.gmail.com>
2012-01-16 21:54   ` fdisk: off-by-one issue in (n)new command Gerardo Exequiel Pozzi
2012-01-16 22:30     ` Gerardo Exequiel Pozzi
2012-01-17 10:07       ` Karel Zak
2012-01-17 14:55         ` Gerardo Exequiel Pozzi [this message]
2012-01-20 14:21           ` Francesco Cosoleto
2012-01-22  1:37             ` Gerardo Exequiel Pozzi

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=4F158BD6.1020006@yahoo.com.ar \
    --to=vmlinuz386@yahoo.com.ar \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.