[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [BusyBox] fdisk.c with 64-bit support: seek_sector is truncating
From:       "Vladimir N. Oleynik" <dzo () simtreas ! ru>
Date:       2004-06-29 15:10:57
Message-ID: 40E18681.50202 () simtreas ! ru
[Download RAW message or body]

Richard,

> Busybox fdisk is not working on large disks where the byte
> offsets can exceed 32-bits.
> 
> The offending code is in seek_sector(uint)
> .......
> off_t offset;
> 
> offset = secno * sector_size
> ......
> The rhs is being truncated to 32-bits before being assigned to offset.
> Is this a compiler bug not to do integer promotion ( I have confirmed that
> LARGEFILE64, FILE_OFFSET_BITS=64 etc are all defined)?
> The following mod works:
> 
> offset = (off_t)secno * (off_t)sector_size;
> 
> and fdisk now prints out the partition table correctly.
> 
> Comments?

Yes. You are right.

Current Erik`s patch make support more 1Tb disk ;-)
and make more slowly and bigger :-(


--w
vodz


_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic