2021-02-28 11:14:25

by Julia Lawall

[permalink] [raw]
Subject: [PATCH] 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]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
Signed-off-by: Julia Lawall <[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(-)

--- a/arch/riscv/kernel/probes/kprobes.c
+++ b/arch/riscv/kernel/probes/kprobes.c
@@ -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);


2021-02-28 15:12:04

by Pekka Enberg

[permalink] [raw]
Subject: Re: [PATCH] riscv: fix bugon.cocci warnings

On Sun, Feb 28, 2021 at 12:10:22PM +0100, Julia Lawall wrote:
> 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]>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: kernel test robot <[email protected]>
> Signed-off-by: Julia Lawall <[email protected]>

Reviewed-by: Pekka Enberg <[email protected]>

2021-03-17 03:38:26

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH] riscv: fix bugon.cocci warnings

On Sun, 28 Feb 2021 03:10:22 PST (-0800), [email protected] wrote:
> 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]>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: kernel test robot <[email protected]>
> Signed-off-by: Julia Lawall <[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(-)
>
> --- a/arch/riscv/kernel/probes/kprobes.c
> +++ b/arch/riscv/kernel/probes/kprobes.c
> @@ -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.