projects/linux·commit 41c14f1a

Merge tag 'x86-urgent-2024-05-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

41c14f1a · Linus Torvalds <[email protected]> · 2024-05-19 11:42:29 -07:00

Pull x86 fixes from Ingo Molnar:

 - Fix a NOP-patching bug that resulted in valid but suboptimal
   NOP sequences in certain cases

 - Fix build warnings related to fall-through control flow

* tag 'x86-urgent-2024-05-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/alternatives: Use the correct length when optimizing NOPs
  x86/boot: Address clang -Wimplicit-fallthrough in vsprintf()
  x86/boot: Add a fallthrough annotation
Commit
41c14f1ac82cdb1e009d635ffd5ae5dc4cc3f036
Parents
8dde191a · 9dba9c67

Merge commit. Changes below are compared with the first parent: 8dde191a.

Changes

3 files changed · +5 −1

FileStatusAddDelContent
arch/x86/boot/Makefilemodified+1−0View file
arch/x86/boot/printf.cmodified+3−0View file
arch/x86/kernel/alternative.cmodified+1−1View file

arch/x86/boot/Makefile

View file
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 1cf24ff..9cc0ff6 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -56,6 +56,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)
$(obj)/bzImage: asflags-y := $(SVGA_MODE)

arch/x86/boot/printf.c

View file
diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c
index 1237bee..51dc14b 100644
--- a/arch/x86/boot/printf.c
+++ b/arch/x86/boot/printf.c
@@ -246,6 +246,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)
case 'x':
flags |= SMALL;
+ fallthrough;
case 'X':
base = 16;
break;
@@ -253,6 +254,8 @@ int vsprintf(char *buf, const char *fmt, va_list args)
case 'd':
case 'i':
flags |= SIGN;
+ break;
+
case 'u':
break;

arch/x86/kernel/alternative.c

View file
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 7555c15..89de612 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -372,7 +372,7 @@ static void __apply_relocation(u8 *buf, const u8 * const instr, size_t instrlen,
void apply_relocation(u8 *buf, const u8 * const instr, size_t instrlen, u8 *repl, size_t repl_len)
{
__apply_relocation(buf, instr, instrlen, repl, repl_len);
- optimize_nops(instr, buf, repl_len);
+ optimize_nops(instr, buf, instrlen);
}
/* Low-level backend functions usable from alternative code replacements. */