[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFhGd8oAunv=+xT84hC2hCp3F-=Oy_gvK08eRmD6nk9xwCvWzQ@mail.gmail.com>
Date: Thu, 16 May 2024 16:08:06 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
Bill Wendling <morbo@...gle.com>, linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
patches@...ts.linux.dev, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] x86/boot: Address clang -Wimplicit-fallthrough in vsprintf()
On Thu, May 16, 2024 at 7:03 AM Nathan Chancellor <nathan@...nel.org> wrote:
>
> After enabling -Wimplicit-fallthrough for the x86 boot code, clang
> warns:
>
> arch/x86/boot/printf.c:257:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
> 257 | case 'u':
> | ^
>
> Clang is a little more pedantic than GCC, which does not warn when
> falling through to a case that is just break or return. Clang's version
> is more in line with the kernel's own stance in deprecated.rst, which
> states that all switch/case blocks must end in either break,
> fallthrough, continue, goto, or return. Add the missing break to silence
> the warning.
>
> Fixes: dd0716c2b877 ("x86/boot: Add a fallthrough annotation")
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202405162054.ryP73vy1-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Seems simple enough.
Acked-by: Justin Stitt <justinstitt@...gle.com>
> ---
> arch/x86/boot/printf.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c
> index c0ec1dc355ab..51dc14b714f6 100644
> --- a/arch/x86/boot/printf.c
> +++ b/arch/x86/boot/printf.c
> @@ -254,6 +254,8 @@ int vsprintf(char *buf, const char *fmt, va_list args)
> case 'd':
> case 'i':
> flags |= SIGN;
> + break;
> +
> case 'u':
> break;
>
>
> ---
> base-commit: dd0716c2b87792ebea30864e7ad1df461d4c1525
> change-id: 20240516-x86-boot-fix-clang-implicit-fallthrough-fc5c9bb19765
>
> Best regards,
> --
> Nathan Chancellor <nathan@...nel.org>
>
Powered by blists - more mailing lists