grub-devel
[Top][All Lists]
Advanced

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

[PATCH v4 00/13] error: Do compile-time format string checking on grub_e


From: Glenn Washburn
Subject: [PATCH v4 00/13] error: Do compile-time format string checking on grub_error
Date: Thu, 18 Feb 2021 20:47:01 -0600

This patch series fixes all compile errors due to format string issues on
grub_error. This was tested against nearly all supported platforms
successfully. This is important because earlier versions of these changes
compiled successfully on x86 platforms, but had issues on other ones not
tested.

All patches except the last fix actual format string issues. The last patch
turns format string issues into errors. This is a good idea because it will
help to prevent introducing new format string issues into the code. Since, I
presume, Daniel does not do not do a build test for all architectures before
committing to master, this will not ensure that no format string issues get
introduced into the code. However, it should flush out any format string
issues when the CI build is done.

Many of these changes are fairly obvious. I tried to use the PRI*GRUB_*_T
macros as much as I could and to not cast arguments. There are some notable
exceptions. There is some code that uses the same grub_error code in both
32 and 64 bit architectures (riscv), so casting was needed to force the larger
storage type. The second to last patch for zfs is still confounding to me
as to why the macro PRIuGRUB_UINT64_T was not expanding to llu, and yet the
compiler was saying the argument was a long long unsigned.

The tests results can be found here:
  https://gitlab.com/gwashburn/grub/-/pipelines/255133408

Glenn

Glenn Washburn (13):
  misc: Format string for grub_error should be a literal
  error: grub_error missing format string argument
  error: grub_error format string add missing format code
  dmraid_nvidia: Format string error in grub_error
  grub_error: Use format code PRIuGRUB_SIZE for variables of type
    grub_size_t
  pgp: Format code for grub_error is incorrect
  efi: Format string error in grub_error
  error: Use %p format code for pointer types
  error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in
    grub_error
  error: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error
  error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock in
    grub_error
  error: Use format code llu for 64-bit uint bp->blk_prop in grub_error
  error: Do compile-time format string checking on grub_error

 grub-core/commands/pgp.c           |  2 +-
 grub-core/disk/ata.c               |  4 ++--
 grub-core/disk/cryptodisk.c        | 12 ++++++++----
 grub-core/disk/dmraid_nvidia.c     |  2 +-
 grub-core/efiemu/i386/loadcore64.c |  3 ++-
 grub-core/fs/hfsplus.c             |  3 ++-
 grub-core/fs/zfs/zfs.c             |  4 ++--
 grub-core/kern/arm64/dl.c          |  3 ++-
 grub-core/kern/efi/efi.c           |  2 +-
 grub-core/kern/efi/mm.c            |  5 +++--
 grub-core/kern/ia64/dl.c           |  3 ++-
 grub-core/kern/riscv/dl.c          |  5 +++--
 grub-core/kern/sparc64/dl.c        |  3 ++-
 grub-core/kern/x86_64/dl.c         |  3 ++-
 grub-core/loader/efi/chainloader.c |  4 ++--
 grub-core/loader/i386/bsd.c        |  3 ++-
 grub-core/loader/i386/pc/linux.c   |  4 ++--
 grub-core/net/tftp.c               |  2 +-
 grub-core/parttool/msdospart.c     |  4 ++--
 grub-core/script/lexer.c           |  2 +-
 grub-core/video/bochs.c            |  4 ++--
 include/grub/err.h                 |  3 ++-
 22 files changed, 47 insertions(+), 33 deletions(-)

-- 
2.27.0




reply via email to

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