From e84a014ee6121424593ded21591c3e759847b784 Mon Sep 17 00:00:00 2001 From: Paul Menzel Date: Fri, 21 May 2021 10:37:38 +0200 Subject: ec/google/wilco/mailbox: Fix format warning by using size_t length modifier Building google/sarien with a 64-bit compiler (x86_64-linux-gnu) fails with the error below. src/ec/google/wilco/mailbox.c: In function 'wilco_ec_transfer': src/ec/google/wilco/mailbox.c:184:43: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] 184 | printk(BIOS_ERR, "%s: data too short (%lu bytes, expected %zu)", | ~~^ | | | long unsigned int | %u 185 | __func__, rs.data_size - skip_size, msg->response_size); | ~~~~~~~~~~~~~~~~~~~~~~~~ | | | size_t {aka unsigned int} `data_size` has type `uint16_t`, and `skip_size` has type `size_t`, whose size differs in 32-bit (unsigned int) and 64-bit (unsigned long). So use the length modifier `z` for a `size_t` argument. Found-by: x86_64-linux-gnu-gcc-10 (Debian 10.2.1-6) 10.2.1 20210110 Change-Id: Ida27323daeed9b8ff487302d0f3d6fcce0bbb705 Signed-off-by: Paul Menzel Reviewed-on: https://review.coreboot.org/c/coreboot/+/54786 Tested-by: build bot (Jenkins) Reviewed-by: Jacob Garber Reviewed-by: Angel Pons Reviewed-by: Furquan Shaikh Reviewed-by: Duncan Laurie --- src/ec/google/wilco/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ec') diff --git a/src/ec/google/wilco/mailbox.c b/src/ec/google/wilco/mailbox.c index f7aac863de..23551f0e3c 100644 --- a/src/ec/google/wilco/mailbox.c +++ b/src/ec/google/wilco/mailbox.c @@ -181,7 +181,7 @@ static int wilco_ec_transfer(struct wilco_ec_message *msg) skip_size = (msg->type == WILCO_EC_MSG_DEFAULT) ? 1 : 0; if (msg->response_size > rs.data_size - skip_size) { - printk(BIOS_ERR, "%s: data too short (%lu bytes, expected %zu)", + printk(BIOS_ERR, "%s: data too short (%zu bytes, expected %zu)", __func__, rs.data_size - skip_size, msg->response_size); return -1; } -- cgit v1.2.3