diff options
author | Paul Menzel <pmenzel@molgen.mpg.de> | 2021-05-21 10:37:38 +0200 |
---|---|---|
committer | Tim Wawrzynczak <twawrzynczak@chromium.org> | 2021-05-26 15:12:31 +0000 |
commit | e84a014ee6121424593ded21591c3e759847b784 (patch) | |
tree | 7f80e897f920dacd27f3483a2cab0940d5cad41d /src/ec | |
parent | ef41e8a44c4c6e69ecfcb257fcbc585e8f02a64e (diff) |
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 <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54786
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Duncan Laurie
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/google/wilco/mailbox.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; } |