Skip to content

Commit

Permalink
MIPS: jump_label: Fix compat branch range check
Browse files Browse the repository at this point in the history
Cast upper bound of branch range to long to do signed compare,
avoid negative offset trigger this warning.

Fixes: 9b6584e ("MIPS: jump_label: Use compact branches for >= r6")
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  • Loading branch information
FlyGoat authored and tsbogend committed Nov 11, 2022
1 parent 2a29615 commit 64ac0be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/mips/kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void arch_jump_label_transform(struct jump_entry *e,
* The branch offset must fit in the instruction's 26
* bit field.
*/
WARN_ON((offset >= BIT(25)) ||
WARN_ON((offset >= (long)BIT(25)) ||
(offset < -(long)BIT(25)));

insn.j_format.opcode = bc6_op;
Expand Down

0 comments on commit 64ac0be

Please sign in to comment.