[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
- [PATCH v4 00/13] error: Do compile-time format string checking on grub_error, Glenn Washburn, 2021/02/18
- [PATCH v4 01/13] misc: Format string for grub_error should be a literal, Glenn Washburn, 2021/02/18
- [PATCH v4 02/13] error: grub_error missing format string argument, Glenn Washburn, 2021/02/18
- [PATCH v4 04/13] dmraid_nvidia: Format string error in grub_error, Glenn Washburn, 2021/02/18
- [PATCH v4 03/13] error: grub_error format string add missing format code, Glenn Washburn, 2021/02/18
- [PATCH v4 08/13] error: Use %p format code for pointer types, Glenn Washburn, 2021/02/18
- [PATCH v4 07/13] efi: Format string error in grub_error, Glenn Washburn, 2021/02/18
- [PATCH v4 06/13] pgp: Format code for grub_error is incorrect, Glenn Washburn, 2021/02/18
- [PATCH v4 10/13] error: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error, Glenn Washburn, 2021/02/18
- [PATCH v4 09/13] error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error, Glenn Washburn, 2021/02/18
- [PATCH v4 13/13] error: Do compile-time format string checking on grub_error, Glenn Washburn, 2021/02/18
- [PATCH v4 05/13] grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t, Glenn Washburn, 2021/02/18
- [PATCH v4 12/13] error: Use format code llu for 64-bit uint bp->blk_prop in grub_error, Glenn Washburn, 2021/02/18