Skip to content

Commit ad74016

Browse files
jgross1Peter Zijlstra
authored andcommitted
x86/alternative: Drop not needed test after call of alt_replace_call()
alt_replace_call() will never return a negative value, so testing the return value to be less than zero can be dropped. This makes it possible to switch the return type of alt_replace_call() and the type of insn_buff_sz to unsigned int. Signed-off-by: Juergen Gross <jgross@suse.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
1 parent 3a86608 commit ad74016

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

arch/x86/kernel/alternative.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ EXPORT_SYMBOL(BUG_func);
559559
* Rewrite the "call BUG_func" replacement to point to the target of the
560560
* indirect pv_ops call "call *disp(%ip)".
561561
*/
562-
static int alt_replace_call(u8 *instr, u8 *insn_buff, struct alt_instr *a)
562+
static unsigned int alt_replace_call(u8 *instr, u8 *insn_buff, struct alt_instr *a)
563563
{
564564
void *target, *bug = &BUG_func;
565565
s32 disp;
@@ -643,7 +643,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
643643
* order.
644644
*/
645645
for (a = start; a < end; a++) {
646-
int insn_buff_sz = 0;
646+
unsigned int insn_buff_sz = 0;
647647

648648
/*
649649
* In case of nested ALTERNATIVE()s the outer alternative might
@@ -683,11 +683,8 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
683683
memcpy(insn_buff, replacement, a->replacementlen);
684684
insn_buff_sz = a->replacementlen;
685685

686-
if (a->flags & ALT_FLAG_DIRECT_CALL) {
686+
if (a->flags & ALT_FLAG_DIRECT_CALL)
687687
insn_buff_sz = alt_replace_call(instr, insn_buff, a);
688-
if (insn_buff_sz < 0)
689-
continue;
690-
}
691688

692689
for (; insn_buff_sz < a->instrlen; insn_buff_sz++)
693690
insn_buff[insn_buff_sz] = 0x90;

0 commit comments

Comments
 (0)