Skip to contentSkip to conversation

x86/boot: Add a fallthrough annotation

PATCH Applied Borislav Petkov 2 participants 2 messages May 16, 2024 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/boot: Add a fallthrough annotation

From: Borislav Petkov <[email protected]>

Add implicit fallthrough checking to the decompressor code and fix this warning:

arch/x86/boot/printf.c: In function ‘vsprintf’:
arch/x86/boot/printf.c:248:10: warning: this statement may \
fall through [-Wimplicit-fallthrough=]

    248 |    flags |= SMALL;
        |          ^
  arch/x86/boot/printf.c:249:3: note: here
    249 |   case 'X':
        |   ^~~~

This is a patch from three years ago which I found in my trees, thus the SUSE authorship still.

---
 arch/x86/boot/Makefile | 1 +
 arch/x86/boot/printf.c | 1 +
 2 files changed, 2 insertions(+)
arch/x86/boot/Makefile +1 -0
index 3cece19b7473..343aef6d752f 100644
@@ -69,6 +69,7 @@ KBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP
 KBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
 KBUILD_CFLAGS	+= $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
 KBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
+KBUILD_CFLAGS	+= $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
 GCOV_PROFILE := n
 UBSAN_SANITIZE := n
 
arch/x86/boot/printf.c +1 -0
index 1237beeb9540..c0ec1dc355ab 100644
@@ -246,6 +246,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
 
 		case 'x':
 			flags |= SMALL;
+			fallthrough;
 		case 'X':
 			base = 16;
 			break;
Signature · 1 line
2.43.0
#1 lore raw
The following commit has been merged into the x86/urgent branch of tip:

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     dd0716c2b87792ebea30864e7ad1df461d4c1525
Gitweb:        https://git.kernel.org/tip/dd0716c2b87792ebea30864e7ad1df461d4c1525
Author:        Borislav Petkov <[email protected]>
AuthorDate:    Thu, 16 May 2024 12:22:40 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Thu, 16 May 2024 12:46:36 +02:00

x86/boot: Add a fallthrough annotation

Add implicit fallthrough checking to the decompressor code and fix this warning:

arch/x86/boot/printf.c: In function ‘vsprintf’:
arch/x86/boot/printf.c:248:10: warning: this statement may fall through [-Wimplicit-fallthrough=]

    248 |    flags |= SMALL;
        |          ^
  arch/x86/boot/printf.c:249:3: note: here
    249 |   case 'X':
        |   ^~~~

This is a patch from three years ago which I found in my trees, thus the SUSE authorship still.

---
 arch/x86/boot/Makefile | 1 +
 arch/x86/boot/printf.c | 1 +
 2 files changed, 2 insertions(+)
arch/x86/boot/Makefile +1 -0
index 3cece19..343aef6 100644
@@ -69,6 +69,7 @@ KBUILD_CFLAGS	:= $(REALMODE_CFLAGS) -D_SETUP
 KBUILD_AFLAGS	:= $(KBUILD_CFLAGS) -D__ASSEMBLY__
 KBUILD_CFLAGS	+= $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
 KBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables
+KBUILD_CFLAGS	+= $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
 GCOV_PROFILE := n
 UBSAN_SANITIZE := n
 
arch/x86/boot/printf.c +1 -0
index 1237bee..c0ec1dc 100644
@@ -246,6 +246,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
 
 		case 'x':
 			flags |= SMALL;
+			fallthrough;
 		case 'X':
 			base = 16;
 			break;