From: Justin Stitt <justinstitt@google.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Bill Wendling <morbo@google.com>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] x86/boot: Address clang -Wimplicit-fallthrough in vsprintf()
Date: Thu, 16 May 2024 16:08:06 -0700 [thread overview]
Message-ID: <CAFhGd8oAunv=+xT84hC2hCp3F-=Oy_gvK08eRmD6nk9xwCvWzQ@mail.gmail.com> (raw)
In-Reply-To: <20240516-x86-boot-fix-clang-implicit-fallthrough-v1-1-04dc320ca07c@kernel.org>
On Thu, May 16, 2024 at 7:03 AM Nathan Chancellor <nathan@kernel.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@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202405162054.ryP73vy1-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Seems simple enough.
Acked-by: Justin Stitt <justinstitt@google.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@kernel.org>
>
next prev parent reply other threads:[~2024-05-16 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 14:03 [PATCH] x86/boot: Address clang -Wimplicit-fallthrough in vsprintf() Nathan Chancellor
2024-05-16 23:08 ` Justin Stitt [this message]
2024-05-17 9:51 ` Borislav Petkov
2024-05-17 15:18 ` Nathan Chancellor
2024-05-23 11:57 ` Borislav Petkov
2024-05-23 23:12 ` Kees Cook
2024-05-24 16:39 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFhGd8oAunv=+xT84hC2hCp3F-=Oy_gvK08eRmD6nk9xwCvWzQ@mail.gmail.com' \
--to=justinstitt@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=patches@lists.linux.dev \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).