svn commit: r281307 - head/sys/boot/efi/boot1

Andrew Turner andrew at fubar.geek.nz
Mon Apr 13 10:49:47 UTC 2015


On Thu, 9 Apr 2015 21:38:02 +1000 (EST)
Bruce Evans <brde at optusnet.com.au> wrote:

> On Thu, 9 Apr 2015, Andrew Turner wrote:
> 
> > Log:
> >  Print error values with hex to make it easier to find the EFI
> > error type.
> >
> > Modified:
> >  head/sys/boot/efi/boot1/boot1.c
> >
> > Modified: head/sys/boot/efi/boot1/boot1.c
> > ==============================================================================
> > --- head/sys/boot/efi/boot1/boot1.c	Thu Apr  9 10:12:58
> > 2015	(r281306) +++ head/sys/boot/efi/boot1/boot1.c
> > Thu Apr  9 10:15:47 2015	(r281307) @@ -330,18 +330,18 @@
> > load(const char *fname) status =
> > systab->BootServices->LoadImage(TRUE, image, bootdevpath, buffer,
> > bufsize, &loaderhandle); if (EFI_ERROR(status))
> > -		printf("LoadImage failed with error %d\n", status);
> > +		printf("LoadImage failed with error %lx\n",
> > status);
> 
> How would anyone guess that a number like "10" is in hex?
> 
> Hex numbers should usually be printed using "%#..." format.  If the
> boot loader doesn't have that, then use an 0x prefix.
> 
> This shouldn't compile.  'status' cannot have type int and type
> unsigned long at the same time.  clang warns even without -Wformat in
> CFLAGS.

It is either uint32_t on 32-bit architectures, or uint64_t on 64-bit
architectures. I know it's wrong on 32-bit, however on both
architectures we use this code a long is 32-bit.

Andrew


More information about the svn-src-all mailing list