diff mbox series

[1/1] tools: mkeficapsule: use %zd to print ssize_t.

Message ID 20241103224505.195451-1-heinrich.schuchardt@canonical.com
State New
Delegated to: Heinrich Schuchardt
Headers show
Series [1/1] tools: mkeficapsule: use %zd to print ssize_t. | expand

Commit Message

Heinrich Schuchardt Nov. 3, 2024, 10:45 p.m. UTC
For printing a ssize_t variable we must use %zd and not %ld to avoid
a -Wformat error on 32-bit systems.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 tools/mkeficapsule.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ilias Apalodimas Nov. 4, 2024, 2:58 a.m. UTC | #1
On Mon, 4 Nov 2024 at 00:45, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> For printing a ssize_t variable we must use %zd and not %ld to avoid
> a -Wformat error on 32-bit systems.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  tools/mkeficapsule.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
> index 49f5b7849e4..fb6c57f77c1 100644
> --- a/tools/mkeficapsule.c
> +++ b/tools/mkeficapsule.c
> @@ -866,12 +866,12 @@ static struct fdt_header *load_dtb(const char *path)
>
>         dtb = malloc(dtb_size);
>         if (!dtb) {
> -               fprintf(stderr, "Can't allocated %ld\n", dtb_size);
> +               fprintf(stderr, "Can't allocated %zd\n", dtb_size);
>                 return NULL;
>         }
>
>         if (fread(dtb, dtb_size, 1, f) != 1) {
> -               fprintf(stderr, "Can't read %ld bytes from %s\n",
> +               fprintf(stderr, "Can't read %zd bytes from %s\n",
>                         dtb_size, path);
>                 free(dtb);
>                 return NULL;
> --
> 2.45.2
>

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c
index 49f5b7849e4..fb6c57f77c1 100644
--- a/tools/mkeficapsule.c
+++ b/tools/mkeficapsule.c
@@ -866,12 +866,12 @@  static struct fdt_header *load_dtb(const char *path)
 
 	dtb = malloc(dtb_size);
 	if (!dtb) {
-		fprintf(stderr, "Can't allocated %ld\n", dtb_size);
+		fprintf(stderr, "Can't allocated %zd\n", dtb_size);
 		return NULL;
 	}
 
 	if (fread(dtb, dtb_size, 1, f) != 1) {
-		fprintf(stderr, "Can't read %ld bytes from %s\n",
+		fprintf(stderr, "Can't read %zd bytes from %s\n",
 			dtb_size, path);
 		free(dtb);
 		return NULL;