From: Keir Fraser Subject: Re: [PATCH]: Fix rombios to correctly report size of disks >16GB Date: Thu, 22 Jul 2010 19:07:13 +0100 Message-ID: References: <1279820544.1723.2029.camel@qabil.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1279820544.1723.2029.camel@qabil.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Gianni Tedesco , Xen Devel List-Id: xen-devel@lists.xenproject.org On 22/07/2010 18:42, "Gianni Tedesco" wrote: > Cosmetic patch for rombios to display the correct sizes of disks larger > than 16GB - a problem caused by needlessly casting sizeinmb variable > down to 16bits. For say a 17GB drive sizeinmb=17000 which can be represented with fewer than 16 bits. I don't see how the code as it is will ever print the wrong thing, except for drives bigger than 64TB! Also I'm not sure but I think the integer size here may be 16 bits, and the %u format specifier would only print 16-bit values in that case anyway. -- Keir > Signed-off-by: Gianni Tedesco > > diff -r 01917c0da12a tools/firmware/rombios/rombios.c > --- a/tools/firmware/rombios/rombios.c Thu Jul 22 13:49:40 2010 +0100 > +++ b/tools/firmware/rombios/rombios.c Thu Jul 22 18:40:26 2010 +0100 > @@ -2856,9 +2856,9 @@ void ata_detect( ) > printf("ata%d %s: ",channel,slave?" slave":"master"); > i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c); > if (sizeinmb < (1UL<<16)) > - printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, > (Bit16u)sizeinmb); > + printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, sizeinmb); > else > - printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, > (Bit16u)(sizeinmb>>10)); > + printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version, > (sizeinmb>>10)); > break; > case ATA_TYPE_ATAPI: > printf("ata%d %s: ",channel,slave?" slave":"master"); > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel