aboutsummaryrefslogtreecommitdiff
path: root/tools/mkeficapsule.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-07 14:27:01 -0700
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-03-16 09:37:04 +0100
commitad09004ac472dedeb6e72f703035e76efa9810ca (patch)
tree178d4cc12e594e5592377c776d6e0ab789b3bfbf /tools/mkeficapsule.c
parentfbc6ceae6f0d97672d11bef8df406ea31c49c0fe (diff)
downloadu-boot-ad09004ac472dedeb6e72f703035e76efa9810ca.zip
u-boot-ad09004ac472dedeb6e72f703035e76efa9810ca.tar.gz
u-boot-ad09004ac472dedeb6e72f703035e76efa9810ca.tar.bz2
mkeficapsule: Correct printf() strings
Use %z when printing size_t values. This avoids errors on 32-bit machines. Signed-off-by: Simon Glass <sjg@chromium.org> Use a conversion to size_t for printing stat.st_size. Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'tools/mkeficapsule.c')
-rw-r--r--tools/mkeficapsule.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
index 1613e74..f272512 100644
--- a/tools/mkeficapsule.c
+++ b/tools/mkeficapsule.c
@@ -278,7 +278,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
}
data = malloc(bin_stat.st_size);
if (!data) {
- printf("cannot allocate memory: %lx\n", bin_stat.st_size);
+ printf("cannot allocate memory: %zx\n", (size_t)bin_stat.st_size);
goto err_1;
}
f = fopen(path, "w");
@@ -297,7 +297,7 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
size = fwrite(&header, 1, sizeof(header), f);
if (size < sizeof(header)) {
- printf("write failed (%lx)\n", size);
+ printf("write failed (%zx)\n", size);
goto err_3;
}
@@ -306,13 +306,13 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
capsule.payload_item_count = 1;
size = fwrite(&capsule, 1, sizeof(capsule), f);
if (size < (sizeof(capsule))) {
- printf("write failed (%lx)\n", size);
+ printf("write failed (%zx)\n", size);
goto err_3;
}
offset = sizeof(capsule) + sizeof(u64);
size = fwrite(&offset, 1, sizeof(offset), f);
if (size < sizeof(offset)) {
- printf("write failed (%lx)\n", size);
+ printf("write failed (%zx)\n", size);
goto err_3;
}
@@ -329,17 +329,17 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid,
size = fwrite(&image, 1, sizeof(image), f);
if (size < sizeof(image)) {
- printf("write failed (%lx)\n", size);
+ printf("write failed (%zx)\n", size);
goto err_3;
}
size = fread(data, 1, bin_stat.st_size, g);
if (size < bin_stat.st_size) {
- printf("read failed (%lx)\n", size);
+ printf("read failed (%zx)\n", size);
goto err_3;
}
size = fwrite(data, 1, bin_stat.st_size, f);
if (size < bin_stat.st_size) {
- printf("write failed (%lx)\n", size);
+ printf("write failed (%zx)\n", size);
goto err_3;
}