Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Juergen Gross and committed by
Peter Zijlstra
ad74016b 3a866087

+3 -6
+3 -6
arch/x86/kernel/alternative.c
··· 559 559 * Rewrite the "call BUG_func" replacement to point to the target of the 560 560 * indirect pv_ops call "call *disp(%ip)". 561 561 */ 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) 563 563 { 564 564 void *target, *bug = &BUG_func; 565 565 s32 disp; ··· 643 643 * order. 644 644 */ 645 645 for (a = start; a < end; a++) { 646 - int insn_buff_sz = 0; 646 + unsigned int insn_buff_sz = 0; 647 647 648 648 /* 649 649 * In case of nested ALTERNATIVE()s the outer alternative might ··· 683 683 memcpy(insn_buff, replacement, a->replacementlen); 684 684 insn_buff_sz = a->replacementlen; 685 685 686 - if (a->flags & ALT_FLAG_DIRECT_CALL) { 686 + if (a->flags & ALT_FLAG_DIRECT_CALL) 687 687 insn_buff_sz = alt_replace_call(instr, insn_buff, a); 688 - if (insn_buff_sz < 0) 689 - continue; 690 - } 691 688 692 689 for (; insn_buff_sz < a->instrlen; insn_buff_sz++) 693 690 insn_buff[insn_buff_sz] = 0x90;