grub_error: Use format code PRIuGRUB_SIZE for variables of type grub_size_t

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn 2021-03-04 18:22:36 -06:00 committed by Daniel Kiper
parent 334c0ef3d0
commit e96c7645f4
4 changed files with 12 additions and 7 deletions

View File

@ -484,13 +484,15 @@ grub_cryptodisk_setcipher (grub_cryptodisk_t crypt, const char *ciphername, cons
} }
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
{ {
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,
cipher->cipher->blocksize); cipher->cipher->blocksize);
goto err; goto err;
} }
if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) if (secondary_cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
{ {
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,
secondary_cipher->cipher->blocksize); secondary_cipher->cipher->blocksize);
goto err; goto err;
} }
@ -501,7 +503,8 @@ grub_cryptodisk_setcipher (grub_cryptodisk_t crypt, const char *ciphername, cons
cipheriv = ciphermode + sizeof ("lrw-") - 1; cipheriv = ciphermode + sizeof ("lrw-") - 1;
if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES) if (cipher->cipher->blocksize != GRUB_CRYPTODISK_GF_BYTES)
{ {
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,
cipher->cipher->blocksize); cipher->cipher->blocksize);
goto err; goto err;
} }
@ -523,7 +526,8 @@ grub_cryptodisk_setcipher (grub_cryptodisk_t crypt, const char *ciphername, cons
{ {
if (cipher->cipher->blocksize & (cipher->cipher->blocksize - 1) if (cipher->cipher->blocksize & (cipher->cipher->blocksize - 1)
|| cipher->cipher->blocksize == 0) || 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,
cipher->cipher->blocksize); cipher->cipher->blocksize);
/* FIXME should we return an error here? */ /* FIXME should we return an error here? */
for (benbi_log = 0; for (benbi_log = 0;

View File

@ -504,7 +504,7 @@ grub_efi_duplicate_device_path (const grub_efi_device_path_t *dp)
if (len < 4) if (len < 4)
{ {
grub_error (GRUB_ERR_OUT_OF_RANGE, 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);
return NULL; return NULL;
} }

View File

@ -164,7 +164,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
if (len < 4) if (len < 4)
{ {
grub_error (GRUB_ERR_OUT_OF_RANGE, 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);
return NULL; return NULL;
} }

View File

@ -2110,7 +2110,8 @@ grub_cmd_openbsd_ramdisk (grub_command_t cmd __attribute__ ((unused)),
{ {
grub_file_close (file); grub_file_close (file);
return grub_error (GRUB_ERR_BAD_OS, "your kOpenBSD supports ramdisk only" 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",
openbsd_ramdisk.max_size, size); openbsd_ramdisk.max_size, size);
} }