[PATCH kexec-tools 07/32] kexec: fix warnings caused by selecting 64-bit file IO on 32-bit platforms

Russell King - ARM Linux linux at armlinux.org.uk
Sat May 28 06:53:20 PDT 2016


On Sat, May 28, 2016 at 07:33:54PM +0800, Baoquan He wrote:
> On 05/03/16 at 11:21am, Russell King wrote:
> > diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c
> > index 9df601b..5e24629 100644
> > --- a/kexec/kexec-uImage.c
> > +++ b/kexec/kexec-uImage.c
> > @@ -82,7 +82,8 @@ int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch)
> >  	if (be32_to_cpu(header.ih_size) > len - sizeof(header)) {
> >  		printf("uImage header claims that image has %d bytes\n",
> >  				be32_to_cpu(header.ih_size));
> > -		printf("we read only %ld bytes.\n", len - sizeof(header));
> > +		printf("we read only %lld bytes.\n",
> > +		       (long long)len - sizeof(header));
> 
> With "D_FILE_OFFSET_BITS=64" adding, off_t is identical to off64_t, is
> that necessary to still take a type conversion here?

The printf format specifies an argument of "long long" type, which is
defined as a data type of at least 64-bits wide.  So, it's more
correct to cast to long long, rather than relying on off64_t being
the same size as long long.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.



More information about the kexec mailing list