mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 10:38:44 -04:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user