From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <daniel.kiper@oracle.com>
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH v6 00/14] error: Do compile-time format string checking on grub>
Date: Thu, 4 Mar 2021 18:22:31 -0600 [thread overview]
Message-ID: <cover.1614903653.git.development@efficientek.com> (raw)
In-Reply-To: <cover.1613700218.git.development@efficientek.com>
Daniel, you mentioned wanting a separate patch series which is the real fix
for patch #12. I've added it to this patch series, since they go together.
I can send the single patch as a separate thread if that still desirable.
Changes since v5
* Fix formatting issues with spaces around format string macros and casts
* Add extra patch #14 which is the better fix for #12, but needs more testing
Glenn
Glenn Washburn (14):
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 PRI* macros to get correct format string code across
architectures
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
zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE macros
grub-core/commands/pgp.c | 4 ++--
grub-core/disk/ata.c | 10 ++++++----
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 | 3 ++-
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 | 7 ++++---
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 ++-
include/grub/zfs/spa.h | 4 ++--
23 files changed, 56 insertions(+), 38 deletions(-)
Range-diff against v5:
1: f34399c63 ! 1: 0f35c04e3 grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t
@@ grub-core/disk/cryptodisk.c: grub_cryptodisk_setcipher (grub_cryptodisk_t crypt,
{
- ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d",
+ ret = grub_error (GRUB_ERR_BAD_ARGUMENT,
-+ "Unsupported XTS block size: %"PRIuGRUB_SIZE,
++ "Unsupported XTS block size: %" PRIuGRUB_SIZE,
cipher->cipher->blocksize);
goto err;
}
@@ grub-core/disk/cryptodisk.c: grub_cryptodisk_setcipher (grub_cryptodisk_t crypt,
{
- ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported XTS block size: %d",
+ ret = grub_error (GRUB_ERR_BAD_ARGUMENT,
-+ "Unsupported XTS block size: %"PRIuGRUB_SIZE,
++ "Unsupported XTS block size: %" PRIuGRUB_SIZE,
secondary_cipher->cipher->blocksize);
goto err;
}
@@ grub-core/disk/cryptodisk.c: grub_cryptodisk_setcipher (grub_cryptodisk_t crypt,
{
- ret = grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported LRW block size: %d",
+ ret = grub_error (GRUB_ERR_BAD_ARGUMENT,
-+ "Unsupported LRW block size: %"PRIuGRUB_SIZE,
++ "Unsupported LRW block size: %" PRIuGRUB_SIZE,
cipher->cipher->blocksize);
goto err;
}
@@ grub-core/disk/cryptodisk.c: grub_cryptodisk_setcipher (grub_cryptodisk_t crypt,
|| cipher->cipher->blocksize == 0)
- grub_error (GRUB_ERR_BAD_ARGUMENT, "Unsupported benbi blocksize: %d",
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
-+ "Unsupported benbi blocksize: %"PRIuGRUB_SIZE,
++ "Unsupported benbi blocksize: %" PRIuGRUB_SIZE,
cipher->cipher->blocksize);
/* FIXME should we return an error here? */
for (benbi_log = 0;
@@ grub-core/kern/efi/efi.c: grub_efi_duplicate_device_path (const grub_efi_device_
{
grub_error (GRUB_ERR_OUT_OF_RANGE,
- "malformed EFI Device Path node has length=%d", len);
-+ "malformed EFI Device Path node has length=%"PRIuGRUB_SIZE, len);
++ "malformed EFI Device Path node has length=%" PRIuGRUB_SIZE, len);
return NULL;
}
@@ grub-core/loader/efi/chainloader.c: make_file_path (grub_efi_device_path_t *dp,
{
grub_error (GRUB_ERR_OUT_OF_RANGE,
- "malformed EFI Device Path node has length=%d", len);
-+ "malformed EFI Device Path node has length=%"PRIuGRUB_SIZE, len);
++ "malformed EFI Device Path node has length=%" PRIuGRUB_SIZE, len);
return NULL;
}
@@ grub-core/loader/i386/bsd.c: grub_cmd_openbsd_ramdisk (grub_command_t cmd __attr
grub_file_close (file);
return grub_error (GRUB_ERR_BAD_OS, "your kOpenBSD supports ramdisk only"
- " up to %u bytes, however you supplied a %u bytes one",
-+ " up to %"PRIuGRUB_SIZE" bytes, however you supplied"
-+ " a %"PRIuGRUB_SIZE" bytes one",
++ " up to %" PRIuGRUB_SIZE " bytes, however you supplied"
++ " a %" PRIuGRUB_SIZE " bytes one",
openbsd_ramdisk.max_size, size);
}
2: 30c3c79fe ! 2: bfff8c10f pgp: Format code for grub_error is incorrect
@@ grub-core/commands/pgp.c: grub_verify_signature_real (struct grub_pubkey_context
{
/* TRANSLATORS: %08x is 32-bit key id. */
- grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08x not found"),
-+ grub_error (GRUB_ERR_BAD_SIGNATURE, N_("public key %08"PRIxGRUB_UINT64_T" not found"),
- keyid);
+- keyid);
++ grub_error (GRUB_ERR_BAD_SIGNATURE,
++ N_("public key %08" PRIxGRUB_UINT64_T " not found"), keyid);
goto fail;
}
+
3: ed754692d ! 3: df4e82eac efi: Format string error in grub_error
@@ grub-core/kern/efi/mm.c: grub_efi_allocate_pages_real (grub_efi_physical_address
grub_error (GRUB_ERR_BAD_ARGUMENT,
- N_("invalid memory address (0x%llx > 0x%llx)"),
- address, GRUB_EFI_MAX_USABLE_ADDRESS);
-+ N_("invalid memory address (0x%"PRIxGRUB_UINT64_T
-+ " > 0x%"PRIxGRUB_UINT64_T")"),
++ N_("invalid memory address (0x%" PRIxGRUB_UINT64_T
++ " > 0x%" PRIxGRUB_UINT64_T ")"),
+ address, (grub_efi_uint64_t) GRUB_EFI_MAX_USABLE_ADDRESS);
return NULL;
}
4: 6a418777d = 4: 6846574fb error: Use PRI* macros to get correct format string code across architectures
5: ea743a1d4 < -: --------- error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error
-: --------- > 5: d059639a1 error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error
6: 40c210e62 ! 6: 1bfdfa47e error: Use format code PRIxGRUB_UINT64_T for 64-bit arg in grub_error
@@ grub-core/kern/ia64/dl.c: grub_arch_dl_relocate_symbols (grub_dl_t mod, void *eh
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- N_("relocation 0x%x is not implemented yet"),
-+ N_("relocation 0x%"PRIxGRUB_UINT64_T
++ N_("relocation 0x%" PRIxGRUB_UINT64_T
+ " is not implemented yet"),
ELF_R_TYPE (rel->r_info));
}
@@ grub-core/kern/riscv/dl.c: grub_arch_dl_relocate_symbols (grub_dl_t mod, void *e
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- N_("relocation 0x%x is not implemented yet"),
- ELF_R_TYPE (rel->r_info));
-+ N_("relocation 0x%"PRIxGRUB_UINT64_T
++ N_("relocation 0x%" PRIxGRUB_UINT64_T
+ " is not implemented yet"),
+ (grub_uint64_t) ELF_R_TYPE (rel->r_info));
}
@@ grub-core/kern/sparc64/dl.c: grub_arch_dl_relocate_symbols (grub_dl_t mod, void
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- N_("relocation 0x%x is not implemented yet"),
-+ N_("relocation 0x%"PRIxGRUB_UINT64_T
++ N_("relocation 0x%" PRIxGRUB_UINT64_T
+ " is not implemented yet"),
ELF_R_TYPE (rel->r_info));
}
@@ grub-core/kern/x86_64/dl.c: grub_arch_dl_relocate_symbols (grub_dl_t mod, void *
default:
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- N_("relocation 0x%x is not implemented yet"),
-+ N_("relocation 0x%"PRIxGRUB_UINT64_T
++ N_("relocation 0x%" PRIxGRUB_UINT64_T
+ " is not implemented yet"),
ELF_R_TYPE (rel->r_info));
}
7: f9b7933f9 ! 7: bacdaf296 error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock in grub_error
@@ grub-core/fs/hfsplus.c: grub_hfsplus_read_block (grub_fshelp_node_t node, grub_d
grub_error (GRUB_ERR_READ_ERROR,
- "no block found for the file id 0x%x and the block offset 0x%x",
+ "no block found for the file id 0x%x and the block"
-+ " offset 0x%"PRIuGRUB_UINT64_T,
++ " offset 0x%" PRIuGRUB_UINT64_T,
node->fileid, fileblock);
break;
}
8: de6688623 ! 8: 88a885a40 error: Use format code llu for 64-bit uint bp->blk_prop in grub_error
@@ Metadata
## Commit message ##
error: Use format code llu for 64-bit uint bp->blk_prop in grub_error
- For some reason PRIuGRUB_UINT64_T is not expanding to llu, but to lu, which
- causes the format string check to fail. Use literal and force cast until
- this is debugged.
+ This is a temporary, less-intrusive change to get the build to success with
+ compiler format string checking turned on. There is a better fix which
+ addresses this issue, but it needs more testing. Use this change so that
+ format string checking on grub_error can be turned on until the better
+ change is fully tested.
## grub-core/fs/zfs/zfs.c ##
@@ grub-core/fs/zfs/zfs.c: zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf,
@@ grub-core/fs/zfs/zfs.c: zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void *
- "unsupported embedded BP (type=%u)\n",
- BPE_GET_ETYPE(bp));
+ "unsupported embedded BP (type=%llu)\n",
-+ (long long unsigned int)BPE_GET_ETYPE(bp));
++ (long long unsigned int) BPE_GET_ETYPE(bp));
lsize = BPE_GET_LSIZE(bp);
psize = BF64_GET_SB(grub_zfs_to_cpu64 ((bp)->blk_prop, endian), 25, 7, 0, 1);
}
9: d071036a3 = 9: d4095f724 error: Do compile-time format string checking on grub_error
10: bba547214 ! 10: 004d029b5 fixup: error: Use format code llu for 64-bit uint bp->blk_prop in grub_error
@@ Metadata
Author: Glenn Washburn <development@efficientek.com>
## Commit message ##
- fixup: error: Use format code llu for 64-bit uint bp->blk_prop in grub_error
+ zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE macros
+
+ The underlying type of grub_uint64_t changes across architectures, but 1ULL
+ does not. This allows using these macros as arguments to format string
+ functions that use the PRI* format string macros that also vary with
+ architecture.
+
+ Change the grub_error call, where this was previously an issue and
+ temporarily fixed by casting and using a format string literal code, to now
+ use PRI* macros and remove casting.
## grub-core/fs/zfs/zfs.c ##
@@ grub-core/fs/zfs/zfs.c: zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void **buf,
@@ grub-core/fs/zfs/zfs.c: zio_read (blkptr_t *bp, grub_zfs_endian_t endian, void *
if (BPE_GET_ETYPE(bp) != BP_EMBEDDED_TYPE_DATA)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
- "unsupported embedded BP (type=%llu)\n",
-- (long long unsigned int)BPE_GET_ETYPE(bp));
+- (long long unsigned int) BPE_GET_ETYPE(bp));
+ "unsupported embedded BP (type=%"
+ PRIuGRUB_UINT64_T ")\n",
+ BPE_GET_ETYPE(bp));
--
2.27.0
next prev parent reply other threads:[~2021-03-05 0:23 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 2:47 [PATCH v4 00/13] error: Do compile-time format string checking on grub_error Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 01/13] misc: Format string for grub_error should be a literal Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 02/13] error: grub_error missing format string argument Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 03/13] error: grub_error format string add missing format code Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 04/13] dmraid_nvidia: Format string error in grub_error Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 05/13] grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 06/13] pgp: Format code for grub_error is incorrect Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 07/13] efi: Format string error in grub_error Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 08/13] error: Use %p format code for pointer types Glenn Washburn
2021-02-27 11:43 ` Daniel Kiper
2021-02-28 20:02 ` Glenn Washburn
2021-03-03 18:05 ` Daniel Kiper
2021-02-19 2:47 ` [PATCH v4 09/13] error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 10/13] error: Use format code PRIxGRUB_UINT64_T for 64-bit arg " Glenn Washburn
2021-02-27 11:48 ` Daniel Kiper
2021-02-28 20:13 ` Glenn Washburn
2021-03-03 18:09 ` Daniel Kiper
2021-02-19 2:47 ` [PATCH v4 11/13] error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock " Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 12/13] error: Use format code llu for 64-bit uint bp->blk_prop " Glenn Washburn
2021-02-27 12:05 ` Daniel Kiper
2021-02-28 21:10 ` Glenn Washburn
2021-03-03 18:17 ` Daniel Kiper
2021-03-04 0:46 ` Glenn Washburn
2021-02-19 2:47 ` [PATCH v4 13/13] error: Do compile-time format string checking on grub_error Glenn Washburn
2021-02-27 12:19 ` [PATCH v4 00/13] " Daniel Kiper
2021-02-28 20:31 ` Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 " Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 01/13] misc: Format string for grub_error should be a literal Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 02/13] error: grub_error missing format string argument Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 03/13] error: grub_error format string add missing format code Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 04/13] dmraid_nvidia: Format string error in grub_error Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 05/13] grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 06/13] pgp: Format code for grub_error is incorrect Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 07/13] efi: Format string error in grub_error Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 08/13] error: Use PRI* macros to get correct format string code across architectures Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 09/13] error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 10/13] error: Use format code PRIxGRUB_UINT64_T for 64-bit arg " Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 11/13] error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock " Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 12/13] error: Use format code llu for 64-bit uint bp->blk_prop " Glenn Washburn
2021-03-04 17:59 ` Daniel Kiper
2021-03-04 22:50 ` Glenn Washburn
2021-03-04 1:29 ` [PATCH v5 13/13] error: Do compile-time format string checking on grub_error Glenn Washburn
2021-03-05 0:22 ` Glenn Washburn [this message]
2021-03-05 0:22 ` [PATCH v6 01/14] misc: Format string for grub_error should be a literal Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 02/14] error: grub_error missing format string argument Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 03/14] error: grub_error format string add missing format code Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 04/14] dmraid_nvidia: Format string error in grub_error Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 05/14] grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 06/14] pgp: Format code for grub_error is incorrect Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 07/14] efi: Format string error in grub_error Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 08/14] error: Use PRI* macros to get correct format string code across architectures Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 09/14] error: Use format code PRIxGRUB_UINT64_T for 64-bit uint argument in grub_error Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 10/14] error: Use format code PRIxGRUB_UINT64_T for 64-bit arg " Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 11/14] error: Use format code PRIuGRUB_UINT64_T for 64-bit typed fileblock " Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 12/14] error: Use format code llu for 64-bit uint bp->blk_prop " Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 13/14] error: Do compile-time format string checking on grub_error Glenn Washburn
2021-03-05 0:22 ` [PATCH v6 14/14] zfs: Use grub_uint64_t instead of 1ULL in BF64_*CODE macros Glenn Washburn
2021-03-05 16:27 ` [PATCH v6 00/14] error: Do compile-time format string checking on grub> Daniel Kiper
2021-03-05 23:15 ` Glenn Washburn
2021-03-06 6:59 ` Threading of patch series (was: [PATCH v6 00/14] error: Do compile-time format string checking on grub>) Paul Menzel
2021-03-07 21:00 ` Glenn Washburn
2021-03-09 21:04 ` Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1614903653.git.development@efficientek.com \
--to=development@efficientek.com \
--cc=daniel.kiper@oracle.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.