aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Menzel <pmenzel@molgen.mpg.de>2021-05-16 20:01:43 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-05-30 20:19:49 +0000
commit85ac0675ed71ab9c5376e549c19267094491e980 (patch)
tree0544f29e0ea8ad445561832612c837ba6593876b
parent2ea9595fcbb63dca2a09a87f19e8598b6346860e (diff)
cpu/x86/smm: Fix size_t type mismatch in print statement
The 64-bit compiler x86_64-linux-gnu-gcc-10 aborts the build with the format warning below: CC ramstage/cpu/x86/smm/smm_module_loader.o src/cpu/x86/smm/smm_module_loader.c: In function 'smm_module_setup_stub': src/cpu/x86/smm/smm_module_loader.c:360:70: error: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'unsigned int' [-Werror=format=] 360 | printk(BIOS_ERR, "%s: state save size: %zx : smm_entry_offset -> %lx\n", | ~~^ | | | long unsigned int | %x As `size_t` is defined as `long unsigned int` in i386-elf (32-bit), the length modifier `l` matches there. With x86_64-elf/x86_64-linux-gnu (64-bit) and `-m32` `size_t` is defined as `unsigned int` resulting in a type mismatch. So, use the correct length modifier `z` for the type `size_t`. Found-by: x86_64-linux-gnu-gcc-10 (Debian 10.2.1-6) 10.2.1 20210110 Fixes: afb7a814 ("cpu/x86/smm: Introduce SMM module loader version 2") Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Change-Id: I4172e0f4dc40437250da89b7720a5c1e5fbab709 Reviewed-on: https://review.coreboot.org/c/coreboot/+/54342 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index 6d999a7290..9f0ae926f3 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -356,7 +356,7 @@ static int smm_module_setup_stub(void *const smbase, const size_t smm_size,
/* The save state size encroached over the first SMM entry point. */
if (size <= SMM_ENTRY_OFFSET) {
printk(BIOS_ERR, "%s: encroachment over SMM entry point\n", __func__);
- printk(BIOS_ERR, "%s: state save size: %zx : smm_entry_offset -> %lx\n",
+ printk(BIOS_ERR, "%s: state save size: %zx : smm_entry_offset -> %zx\n",
__func__, size, (size_t)SMM_ENTRY_OFFSET);
return -1;
}