Skip to content

Commit 23ab672

Browse files
committed
x86/alternatives: Optimize optimize_nops()
JIRA: https://issues.redhat.com/browse/RHEL-68940 commit c3a3cb5 Author: Borislav Petkov (AMD) <bp@alien8.de> Date: Tue, 30 Jan 2024 11:59:40 +0100 x86/alternatives: Optimize optimize_nops() 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 Signed-off-by: Waiman Long <longman@redhat.com>
1 parent 042a5ed commit 23ab672

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/kernel/alternative.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ static void noinline optimize_nops(const u8 * const instr, u8 *buf, size_t len)
233233
if (insn_is_nop(&insn)) {
234234
int nop = i;
235235

236+
/* Has the NOP already been optimized? */
237+
if (i + insn.length == len)
238+
return;
239+
236240
next = skip_nops(buf, next, len);
237241

238242
add_nop(buf + nop, next - nop);

0 commit comments

Comments
 (0)