projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
da8f9cf
)
x86/alternatives: Optimize optimize_nops()
author
Borislav Petkov (AMD)
<bp@alien8.de>
Tue, 30 Jan 2024 10:59:40 +0000
(11:59 +0100)
committer
Borislav Petkov (AMD)
<bp@alien8.de>
Tue, 9 Apr 2024 16:15:03 +0000
(18:15 +0200)
Return early if NOPs have already been optimized.
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link:
https://lore.kernel.org/r/20240130105941.19707-4-bp@alien8.de
arch/x86/kernel/alternative.c
patch
|
blob
|
history
diff --git
a/arch/x86/kernel/alternative.c
b/arch/x86/kernel/alternative.c
index 4b3378c715182e0eabd880668eacb88f88bed4b1..67dd7c371d28a57c879168f7c752a315658771df 100644
(file)
--- a/
arch/x86/kernel/alternative.c
+++ b/
arch/x86/kernel/alternative.c
@@
-233,6
+233,10
@@
static void noinline optimize_nops(const u8 * const instr, u8 *buf, size_t len)
if (insn_is_nop(&insn)) {
int nop = i;
+ /* Has the NOP already been optimized? */
+ if (i + insn.length == len)
+ return;
+
next = skip_nops(buf, next, len);
add_nop(buf + nop, next - nop);