]> git.baikalelectronics.ru Git - kernel.git/commitdiff
MIPS: jump_label: Fix compat branch range check
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Thu, 3 Nov 2022 15:10:53 +0000 (15:10 +0000)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 11 Nov 2022 14:46:03 +0000 (15:46 +0100)
Cast upper bound of branch range to long to do signed compare,
avoid negative offset trigger this warning.

Fixes: 9b6584e35f40 ("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>
arch/mips/kernel/jump_label.c

index 71a882c8c6eb15bddbcafff2df73235a2f75567a..f7978d50a2ba59ab9234a40998cc06292daa4d1e 100644 (file)
@@ -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;