grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 08/13] error: Use %p format code for pointer types


From: Glenn Washburn
Subject: Re: [PATCH v4 08/13] error: Use %p format code for pointer types
Date: Sun, 28 Feb 2021 14:02:20 -0600

On Sat, 27 Feb 2021 12:43:06 +0100
Daniel Kiper <dkiper@net-space.pl> wrote:

> On Thu, Feb 18, 2021 at 08:47:09PM -0600, Glenn Washburn wrote:
> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > ---
> >  grub-core/loader/i386/pc/linux.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/grub-core/loader/i386/pc/linux.c
> > b/grub-core/loader/i386/pc/linux.c index 814988ab9..0bc5d6807 100644
> > --- a/grub-core/loader/i386/pc/linux.c
> > +++ b/grub-core/loader/i386/pc/linux.c
> > @@ -230,9 +230,9 @@ grub_cmd_linux (grub_command_t cmd
> > __attribute__ ((unused)), && GRUB_LINUX_ZIMAGE_ADDR +
> > grub_linux16_prot_size
> >        > grub_linux_real_target)
> >      {
> > -      grub_error (GRUB_ERR_BAD_OS, "too big zImage (0x%x > 0x%x),
> > use bzImage instead",
> > +      grub_error (GRUB_ERR_BAD_OS, "too big zImage (%p > %p), use
> > bzImage instead", (char *) GRUB_LINUX_ZIMAGE_ADDR +
> > grub_linux16_prot_size,
> > -             (grub_size_t) grub_linux_real_target);
> > +             (void *) grub_linux_real_target);
> 
> I would use PRIxGRUB_SIZE and PRIxGRUB_ADDR respectively.

IIRC, The reason I chose the %p format string was because the compiler
considers it an error to use a pointer for an integer format string
code. Does it make more sense to have both be PRIxGRUB_ADDR and for
PRIxGRUB_ADDR to be defined as "p"?

Since they are both pointers, I'm not following why the code should be
semantically different (ie PRIxGRUB_SIZE and PRIxGRUB_ADDR, instead of
just one of those). If you do want to use a "*x" format code, I think
we'd need to cast those arguments.

Glenn



reply via email to

[Prev in Thread] Current Thread [Next in Thread]