summaryrefslogtreecommitdiff
path: root/src/drivers/ipmi
diff options
context:
space:
mode:
authorPaul Menzel <pmenzel@molgen.mpg.de>2021-11-09 08:36:52 +0100
committerFelix Held <felix-coreboot@felixheld.de>2022-01-07 15:27:44 +0000
commit7be44d2ad6a52c59147e804ffc13a86e0fd937cb (patch)
tree0a0ab8715ff2a901c748c7260da4c1c1707f5b30 /src/drivers/ipmi
parentff553ba8b3d39fba6f1ed9b8e3513fc5412ba5a9 (diff)
drivers/ipmi: Use correct unsigned int length modifier
Building an image for OCP DeltaLake with `x86_64-linux-gnu-gcc-11` fails with the format warning below as the size of char * differs between 32-bit and 64-bit. CC ramstage/drivers/ipmi/ipmi_fru.o src/drivers/ipmi/ipmi_fru.c: In function 'read_fru_chassis_info_area': src/drivers/ipmi/ipmi_fru.c:192:57: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Werror=format=] 192 | printk(BIOS_ERR, "%s failed to malloc %ld bytes for " | ~~^ | | | long int | %d 193 | "chassis custom data array.\n", __func__, 194 | info->custom_count * sizeof(char *)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | unsigned int src/drivers/ipmi/ipmi_fru.c: In function 'read_fru_board_info_area': src/drivers/ipmi/ipmi_fru.c:291:57: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Werror=format=] 291 | printk(BIOS_ERR, "%s failed to malloc %ld bytes for " | ~~^ | | | long int | %d 292 | "board custom data array.\n", __func__, 293 | info->custom_count * sizeof(char *)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | unsigned int src/drivers/ipmi/ipmi_fru.c: In function 'read_fru_product_info_area': src/drivers/ipmi/ipmi_fru.c:398:57: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Werror=format=] 398 | printk(BIOS_ERR, "%s failed to malloc %ld bytes for " | ~~^ | | | long int | %d 399 | "product custom data array.\n", __func__, 400 | info->custom_count * sizeof(char *)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | unsigned int Fix the mismatches in `read_fru_chassis_info_area()` by using the length modifier `z` for size_t as that is what `size_of` yields to. Change-Id: If0c4266b19d56fa88abc397f305154d473ae1a93 Found-by: gcc (Debian 11.2.0-10) 11.2.0 Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/59055 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/drivers/ipmi')
-rw-r--r--src/drivers/ipmi/ipmi_fru.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/drivers/ipmi/ipmi_fru.c b/src/drivers/ipmi/ipmi_fru.c
index 31ac6c0d9c..d26a9b752b 100644
--- a/src/drivers/ipmi/ipmi_fru.c
+++ b/src/drivers/ipmi/ipmi_fru.c
@@ -189,7 +189,7 @@ static enum cb_err read_fru_chassis_info_area(const int port, const uint8_t id,
info->chassis_custom = malloc(info->custom_count * sizeof(char *));
if (!info->chassis_custom) {
- printk(BIOS_ERR, "%s failed to malloc %ld bytes for "
+ printk(BIOS_ERR, "%s failed to malloc %zu bytes for "
"chassis custom data array.\n", __func__,
info->custom_count * sizeof(char *));
ret = CB_ERR;
@@ -288,7 +288,7 @@ static enum cb_err read_fru_board_info_area(const int port, const uint8_t id,
info->board_custom = malloc(info->custom_count * sizeof(char *));
if (!info->board_custom) {
- printk(BIOS_ERR, "%s failed to malloc %ld bytes for "
+ printk(BIOS_ERR, "%s failed to malloc %zu bytes for "
"board custom data array.\n", __func__,
info->custom_count * sizeof(char *));
ret = CB_ERR;
@@ -395,7 +395,7 @@ static enum cb_err read_fru_product_info_area(const int port, const uint8_t id,
info->product_custom = malloc(info->custom_count * sizeof(char *));
if (!info->product_custom) {
- printk(BIOS_ERR, "%s failed to malloc %ld bytes for "
+ printk(BIOS_ERR, "%s failed to malloc %zu bytes for "
"product custom data array.\n", __func__,
info->custom_count * sizeof(char *));
ret = CB_ERR;