[PATCH v1 3/5] lib/efi: Fix build warnings
Jeremy Kerr
jk at ozlabs.org
Sun May 3 15:58:58 AEST 2020
Hi Geoff,
> Fixes build warnings like these when building as 32-bit:
>
> warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘ssize_t’
Fixing these is great, but a few comments:
> @@ -71,7 +71,7 @@ bool efi_check_mount_magic(const struct efi_mount *efi_mount, bool check_magic)
> return false;
> }
>
> - if (check_magic && s.f_type != EFIVARFS_MAGIC) {
> + if (check_magic && ((unsigned long)s.f_type != EFIVARFS_MAGIC)) {
It's moderately awful that f_type changes in signed-ness between
platforms, but the fix is good.
> @@ -183,12 +183,12 @@ int efi_get_variable(void *ctx, const struct efi_mount *efi_mount,
> continue;
>
> pb_log("%s: read failed %s: (%ld) (%d) %s\n", __func__, path,
> - count, errno, strerror(errno));
> + (long int)count, errno, strerror(errno));
For these, can you change the format to %zd, rather than introduce the
cast?
Cheers,
Jeremy
More information about the Petitboot
mailing list