[Skiboot] [PATCH] gard: fix compile error on ARM

Cédric Le Goater clg at kaod.org
Tue May 24 03:24:35 AEST 2016


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 at kaod.org>
---
 external/gard/gard.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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);
 
 	/*



More information about the Skiboot mailing list