From 1f07797d849cd86dea3a81f79454821b7217032f Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Wed, 15 Jun 2022 15:36:03 +0200 Subject: [PATCH] cpu/x86/smm/smm_module_loader.c: Fix formatted print This fixes following errors when building GA-945GCM-S2L with clang 14.0.5. CC ramstage/cpu/x86/smm/smm_module_loader.o src/cpu/x86/smm/smm_module_loader.c:180:10: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] region_offset(&cpus[i].stub_code), i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/cpu/x86/smm/smm_module_loader.c:184:20: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] __func__, region_offset(&cpus[0].stub_code), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/cpu/x86/smm/smm_module_loader.c:185:10: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] region_offset(&cpus[i].stub_code), size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/cpu/x86/smm/smm_module_loader.c:349:52: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] printk(BIOS_DEBUG, "%-12s [0x%lx-0x%lx]\n", name, region_offset(®ion), ~~~ ^~~~~~~~~~~~~~~~~~~~~~ %zx src/cpu/x86/smm/smm_module_loader.c:350:9: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] region_end(®ion)); Signed-off-by: Elyes Haouas Change-Id: I59f20aacf91cb50fb194a84082a643b34c6c1ae5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65154 Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) --- src/cpu/x86/smm/smm_module_loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index c3de3f3329..768d2ca1bb 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -170,17 +170,17 @@ u32 smm_get_cpu_smbase(unsigned int cpu_num) static void smm_place_entry_code(const unsigned int num_cpus) { unsigned int i; - unsigned int size; + size_t size; /* start at 1, the first CPU stub code is already there */ size = region_sz(&cpus[0].stub_code); for (i = 1; i < num_cpus; i++) { printk(BIOS_DEBUG, - "SMM Module: placing smm entry code at %lx, cpu # 0x%x\n", + "SMM Module: placing smm entry code at %zx, cpu # 0x%x\n", region_offset(&cpus[i].stub_code), i); memcpy((void *)region_offset(&cpus[i].stub_code), (void *)region_offset(&cpus[0].stub_code), size); - printk(BIOS_SPEW, "%s: copying from %lx to %lx 0x%x bytes\n", + printk(BIOS_SPEW, "%s: copying from %zx to %zx 0x%zx bytes\n", __func__, region_offset(&cpus[0].stub_code), region_offset(&cpus[i].stub_code), size); } @@ -346,7 +346,7 @@ static void setup_smihandler_params(struct smm_runtime *mod_params, static void print_region(const char *name, const struct region region) { - printk(BIOS_DEBUG, "%-12s [0x%lx-0x%lx]\n", name, region_offset(®ion), + printk(BIOS_DEBUG, "%-12s [0x%zx-0x%zx]\n", name, region_offset(®ion), region_end(®ion)); }