lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFhGd8rj+czcvzKsFjcBs1L_jJiar1H9n7mHmnfWKNH0MpFueA@mail.gmail.com>
Date: Fri, 5 Apr 2024 14:55:01 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>, Arnd Bergmann <arnd@...db.de>, Thomas Gleixner <tglx@...utronix.de>, 
	Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, 
	"H. Peter Anvin" <hpa@...or.com>, Nathan Chancellor <nathan@...nel.org>, 
	Nick Desaulniers <ndesaulniers@...gle.com>, Bill Wendling <morbo@...gle.com>, 
	Ashok Raj <ashok.raj@...el.com>, Nathan Fontenot <nathan.fontenot@....com>, 
	Paolo Bonzini <pbonzini@...hat.com>, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] x86: microcode: avoid -Wformat warning with clang-15

On Fri, Apr 5, 2024 at 1:49 PM Arnd Bergmann <arnd@...nel.org> wrote:
>
> From: Arnd Bergmann <arnd@...db.de>
>
> 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.
>
> Fixes: 2e9064faccd1 ("x86/microcode/amd: Fix snprintf() format string warning in W=1 build")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Yeah the family only needs a byte so this is OK.

Reviewed-by: Justin Stitt <justinstitt@...gle.com>

> ---
>  arch/x86/kernel/cpu/microcode/amd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
> index 13b45b9c806d..620f0af713ca 100644
> --- a/arch/x86/kernel/cpu/microcode/amd.c
> +++ b/arch/x86/kernel/cpu/microcode/amd.c
> @@ -465,7 +465,7 @@ static bool early_apply_microcode(u32 cpuid_1_eax, u32 old_rev, void *ucode, siz
>         return !__apply_microcode_amd(mc);
>  }
>
> -static bool get_builtin_microcode(struct cpio_data *cp, unsigned int family)
> +static bool get_builtin_microcode(struct cpio_data *cp, u8 family)
>  {
>         char fw_name[36] = "amd-ucode/microcode_amd.bin";
>         struct firmware fw;
> --
> 2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ