Skip to content

Commit dd0716c

Browse files
suryasaimadhuIngo Molnar
authored andcommitted
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. Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20240516102240.16270-1-bp@kernel.org
1 parent 9776dd3 commit dd0716c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/x86/boot/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ KBUILD_CFLAGS := $(REALMODE_CFLAGS) -D_SETUP
6969
KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
7070
KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
7171
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
72+
KBUILD_CFLAGS += $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
7273
GCOV_PROFILE := n
7374
UBSAN_SANITIZE := n
7475

arch/x86/boot/printf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
246246

247247
case 'x':
248248
flags |= SMALL;
249+
fallthrough;
249250
case 'X':
250251
base = 16;
251252
break;

0 commit comments

Comments
 (0)