[PATCH v1 3/5] lib/efi: Fix build warnings
Geoff Levand
geoff at infradead.org
Mon Apr 27 13:38:31 AEST 2020
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’
Signed-off-by: Geoff Levand <geoff at infradead.org>
---
lib/efi/efivar.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/efi/efivar.c b/lib/efi/efivar.c
index 37bb6d9..75863ba 100644
--- a/lib/efi/efivar.c
+++ b/lib/efi/efivar.c
@@ -34,7 +34,7 @@
#include "talloc/talloc.h"
#ifndef EFIVARFS_MAGIC
-#define EFIVARFS_MAGIC 0xde5e81e4
+#define EFIVARFS_MAGIC 0xde5e81e4UL
#endif
void efi_init_mount(struct efi_mount *efi_mount, const char *path,
@@ -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)) {
pb_debug_fn("Bad magic = 0x%lx\n", (unsigned long)s.f_type);
return false;
}
@@ -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));
goto exit;
}
if (p >= (buf + sizeof(buf))) {
pb_log("%s: buffer full %s: (%ld)\n", __func__, path,
- sizeof(buf));
+ (long int)sizeof(buf));
goto exit;
}
if (count == 0)
@@ -242,7 +242,7 @@ int efi_set_variable(const struct efi_mount *efi_mount, const char *name,
count = write(fd, buf, bufsize);
if ((size_t)count != bufsize) {
pb_log("%s: write failed %s: (%ld) (%d) %s\n", __func__, name,
- count, errno, strerror(errno));
+ (long int)count, errno, strerror(errno));
goto exit;
}
rc = 0;
--
2.20.1
More information about the Petitboot
mailing list