Skip to content

Commit 9e11fc7

Browse files
arndbbp3tk0v
authored andcommitted
x86/microcode/AMD: Avoid -Wformat warning with clang-15
Older versions of clang show a warning for amd.c after a fix for a gcc warning: arch/x86/kernel/cpu/microcode/amd.c:478:47: error: format specifies type \ 'unsigned char' but the argument has type 'u16' (aka 'unsigned short') [-Werror,-Wformat] "amd-ucode/microcode_amd_fam%02hhxh.bin", family); ~~~~~~ ^~~~~~ %02hx In clang-16 and higher, this warning is disabled by default, but clang-15 is still supported, and it's trivial to avoid by adapting the types according to the range of the passed data and the format string. [ bp: Massage commit message. ] Fixes: 2e9064f ("x86/microcode/amd: Fix snprintf() format string warning in W=1 build") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240405204919.1003409-1-arnd@kernel.org
1 parent 39cd87c commit 9e11fc7

File tree

1 file changed

+1
-1
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+1
-1
lines changed

arch/x86/kernel/cpu/microcode/amd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static bool early_apply_microcode(u32 cpuid_1_eax, u32 old_rev, void *ucode, siz
465465
return !__apply_microcode_amd(mc);
466466
}
467467

468-
static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
468+
static bool get_builtin_microcode(struct cpio_data *cp, u8 family)
469469
{
470470
char fw_name[36] = "amd-ucode/microcode_amd.bin";
471471
struct firmware fw;

0 commit comments

Comments
 (0)