Skip to contentSkip to conversation

riscv: fix bugon.cocci warnings

PATCH In review Julia Lawall 3 participants 3 messages Feb 28, 2021 – Mar 17, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: fix bugon.cocci warnings

From: kernel test robot <[email protected]>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

Fixes c22b0bcb1dd0 ("riscv: Add kprobes supported")
CC Guo Ren <[email protected]>

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5695e51619745d4fe3ec2506a2f0cd982c5e27a4
commit: c22b0bcb1dd024cb9caad9230e3a387d8b061df5 riscv: Add kprobes supported

:::::: branch date: 3 hours ago
:::::: commit date: 6 weeks ago

 kprobes.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/riscv/kernel/probes/kprobes.c +1 -2
@@ -256,8 +256,7 @@ int __kprobes kprobe_fault_handler(struc
 		 * normal page fault.
 		 */
 		regs->epc = (unsigned long) cur->addr;
-		if (!instruction_pointer(regs))
-			BUG();
+		BUG_ON(!instruction_pointer(regs));
 
 		if (kcb->kprobe_status == KPROBE_REENTER)
 			restore_previous_kprobe(kcb);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Julia Lawall

From: kernel test robot <[email protected]>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

Fixes c22b0bcb1dd0 ("riscv: Add kprobes supported")
CC Guo Ren <[email protected]>
#2 lore raw
In reply to Julia Lawall
Quoted 25 lines · julia.lawall(a)inria.fr

From: kernel test robot <[email protected]>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

Fixes c22b0bcb1dd0 ("riscv: Add kprobes supported")
CC Guo Ren <[email protected]>

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5695e51619745d4fe3ec2506a2f0cd982c5e27a4
commit: c22b0bcb1dd024cb9caad9230e3a387d8b061df5 riscv: Add kprobes supported

:::::: branch date: 3 hours ago
:::::: commit date: 6 weeks ago

 kprobes.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

arch/riscv/kernel/probes/kprobes.c int __kprobes kprobe_fault_handler(struc · line 262

Quoted 9 lines
arch/riscv/kernel/probes/kprobes.c +1 -2
@@ -256,8 +256,7 @@ int __kprobes kprobe_fault_handler(struc
 		 * normal page fault.
 		 */
 		regs->epc = (unsigned long) cur->addr;
-		if (!instruction_pointer(regs))
-			BUG();
+		BUG_ON(!instruction_pointer(regs));
 
 		if (kcb->kprobe_status == KPROBE_REENTER)
 			restore_previous_kprobe(kcb);

Thanks, this is on fixes.