diff mbox

gard: fix compile error on ARM

Message ID 1464024275-4919-1-git-send-email-clg@kaod.org
State Accepted
Headers show

Commit Message

Cédric Le Goater May 23, 2016, 5:24 p.m. UTC
gard can be used on the BMC to query garded records, but currently
compile fails with :

  cc -O2 -Wall -Werror -I. -c gard.c -o gard.o
  gard.c: In function 'do_clear_i':
  gard.c:421:12: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' [-Werror=format]
  gard.c: In function 'check_gard_partition':
  gard.c:489:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Werror=format]

This patches provides a fix compatible with x86, armel, ppc64.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 external/gard/gard.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stewart Smith June 7, 2016, 4:06 a.m. UTC | #1
Cédric Le Goater <clg@kaod.org> writes:
> gard can be used on the BMC to query garded records, but currently
> compile fails with :
>
>   cc -O2 -Wall -Werror -I. -c gard.c -o gard.o
>   gard.c: In function 'do_clear_i':
>   gard.c:421:12: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' [-Werror=format]
>   gard.c: In function 'check_gard_partition':
>   gard.c:489:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'unsigned int' [-Werror=format]
>
> This patches provides a fix compatible with x86, armel, ppc64.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
>  external/gard/gard.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks! Merged to master as of 92a2732
diff mbox

Patch

Index: skiboot.git/external/gard/gard.c
===================================================================
--- skiboot.git.orig/external/gard/gard.c
+++ skiboot.git/external/gard/gard.c
@@ -417,8 +417,8 @@  static int do_clear_i(struct gard_ctx *c
 		rc = blocklevel_smart_write(ctx->bl, buf_pos - sizeof_gard(ctx), buf, buf_len);
 		free(buf);
 		if (rc) {
-			fprintf(stderr, "Couldn't write to flash at 0x%08lx for len 0x%08x\n",
-			        buf_pos - sizeof_gard(ctx), buf_len);
+			fprintf(stderr, "Couldn't write to flash at 0x%08x for len 0x%08x\n",
+			        buf_pos - (int) sizeof_gard(ctx), buf_len);
 			return rc;
 		}
 	}
@@ -485,7 +485,7 @@  int check_gard_partition(struct gard_ctx
 	if (ctx->gard_data_len == 0 || ctx->gard_data_len % sizeof(struct gard_record) != 0)
 		/* Just warn for now */
 		fprintf(stderr, "The %s partition doesn't appear to be an exact multiple of"
-				"gard records in size: %lu vs %u (or partition is zero in length)\n",
+				"gard records in size: %zd vs %u (or partition is zero in length)\n",
 				FLASH_GARD_PART, sizeof(struct gard_record), ctx->gard_data_len);
 
 	/*