* [PATCH] sfdisk: fix calculation due to type mismatch (ix86)
@ 2012-04-06 14:53 Petr Uzel
2012-04-10 10:34 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Petr Uzel @ 2012-04-06 14:53 UTC (permalink / raw)
To: util-linux
Instructing sfdisk to create one partition spanning
across entire disk (",,") on 32bit system, if the disk
is sufficiently large (~2TB) leads to wrong calculation
in compute_start_sect() due to type mismatch.
Can be reproduced as:
--------------------------
linux-3ln5:~ # modprobe scsi_debug virtual_gb=2000
linux-3ln5:~ # sfdisk /dev/sda <<< ',,'
Checking that no-one is using this disk right now ...
OK
Disk /dev/sda: 261083 cylinders, 255 heads, 63 sectors/track
sfdisk: ERROR: sector 0 does not have an msdos signature
sfdisk: /dev/sda: unrecognized partition table type
Old situation:
sfdisk: No partitions found
no room for partition descriptor
sfdisk: bad input
--------------------------
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789
Reported-by: Dan Mares <dan.mares@norcrossgroup.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
fdisk/sfdisk.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 87929d3..350bf1d 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1991,7 +1991,7 @@ static int
compute_start_sect(struct part_desc *p, struct part_desc *ep) {
unsigned long long base;
int inc = (DOS && B.sectors) ? B.sectors : 1;
- int delta;
+ long long delta;
if (ep && p->start + p->size >= ep->start + 1)
delta = p->start - ep->start - inc;
@@ -2006,7 +2006,7 @@ compute_start_sect(struct part_desc *p, struct part_desc *ep) {
p->size += delta;
if (is_extended(p->p.sys_type) && boxes == ONESECTOR)
p->size = inc;
- else if ((ssize_t) old_size <= (ssize_t) - delta) {
+ else if ((long long) old_size <= -delta) {
my_warn(_("no room for partition descriptor\n"));
return 0;
}
--
1.7.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sfdisk: fix calculation due to type mismatch (ix86)
2012-04-06 14:53 [PATCH] sfdisk: fix calculation due to type mismatch (ix86) Petr Uzel
@ 2012-04-10 10:34 ` Karel Zak
2012-04-25 15:16 ` Jonathan Nieder
0 siblings, 1 reply; 4+ messages in thread
From: Karel Zak @ 2012-04-10 10:34 UTC (permalink / raw)
To: Petr Uzel; +Cc: util-linux
On Fri, Apr 06, 2012 at 04:53:13PM +0200, Petr Uzel wrote:
> Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789
> Reported-by: Dan Mares <dan.mares@norcrossgroup.com>
> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Ah.. pretty dirty bug. Applied, thanks.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sfdisk: fix calculation due to type mismatch (ix86)
2012-04-10 10:34 ` Karel Zak
@ 2012-04-25 15:16 ` Jonathan Nieder
2012-05-02 7:22 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Nieder @ 2012-04-25 15:16 UTC (permalink / raw)
To: Karel Zak; +Cc: Petr Uzel, util-linux
Hi Karel,
Karel Zak wrote:
> On Fri, Apr 06, 2012 at 04:53:13PM +0200, Petr Uzel wrote:
>> Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789
>> Reported-by: Dan Mares <dan.mares@norcrossgroup.com>
>> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
>
> Ah.. pretty dirty bug. Applied, thanks.
(This is 9c45d49fe01c "sfdisk: fix calculation due to type mismatch
(ix86)".) Thanks. Do you think this fix might belong in currently
maintained stable/ branches, too, and if so, how can I help make that
happen?
Context: http://bugs.debian.org/670127
Sincerely,
Jonathan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sfdisk: fix calculation due to type mismatch (ix86)
2012-04-25 15:16 ` Jonathan Nieder
@ 2012-05-02 7:22 ` Karel Zak
0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2012-05-02 7:22 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Petr Uzel, util-linux
On Wed, Apr 25, 2012 at 10:16:03AM -0500, Jonathan Nieder wrote:
> >> Addresses: https://bugzilla.novell.com/show_bug.cgi?id=754789
> >> Reported-by: Dan Mares <dan.mares@norcrossgroup.com>
> >> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
> >
> > Ah.. pretty dirty bug. Applied, thanks.
>
> (This is 9c45d49fe01c "sfdisk: fix calculation due to type mismatch
> (ix86)".) Thanks. Do you think this fix might belong in currently
> maintained stable/ branches, too, and if so, how can I help make that
> happen?
I'm going to release 2.21.2 next week.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-02 7:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06 14:53 [PATCH] sfdisk: fix calculation due to type mismatch (ix86) Petr Uzel
2012-04-10 10:34 ` Karel Zak
2012-04-25 15:16 ` Jonathan Nieder
2012-05-02 7:22 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox