All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] riscv: fix bugon.cocci warnings
@ 2021-02-28 11:10 ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2021-02-28 11:10 UTC (permalink / raw)
  To: Guo Ren, Palmer Dabbelt, Patrick Stählin, Pekka Enberg
  Cc: linux-kernel, kbuild-all

From: kernel test robot <lkp@intel.com>

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 <guoren@linux.alibaba.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] riscv: fix bugon.cocci warnings
@ 2021-02-28 11:10 ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2021-02-28 11:10 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]

From: kernel test robot <lkp@intel.com>

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 <guoren@linux.alibaba.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] riscv: fix bugon.cocci warnings
  2021-02-28 11:10 ` Julia Lawall
@ 2021-02-28 14:56   ` Pekka Enberg
  -1 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2021-02-28 14:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Guo Ren, Palmer Dabbelt, Patrick Stählin, Pekka Enberg,
	linux-kernel, kbuild-all

On Sun, Feb 28, 2021 at 12:10:22PM +0100, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> 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 <guoren@linux.alibaba.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] riscv: fix bugon.cocci warnings
@ 2021-02-28 14:56   ` Pekka Enberg
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2021-02-28 14:56 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 531 bytes --]

On Sun, Feb 28, 2021 at 12:10:22PM +0100, Julia Lawall wrote:
> From: kernel test robot <lkp@intel.com>
> 
> 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 <guoren@linux.alibaba.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] riscv: fix bugon.cocci warnings
  2021-02-28 11:10 ` Julia Lawall
@ 2021-03-17  3:36   ` Palmer Dabbelt
  -1 siblings, 0 replies; 7+ messages in thread
From: Palmer Dabbelt @ 2021-03-17  3:36 UTC (permalink / raw)
  To: julia.lawall; +Cc: guoren, me, penberg, linux-kernel, kbuild-all

On Sun, 28 Feb 2021 03:10:22 PST (-0800), julia.lawall@inria.fr wrote:
> From: kernel test robot <lkp@intel.com>
>
> 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 <guoren@linux.alibaba.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> ---
>
> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] riscv: fix bugon.cocci warnings
@ 2021-03-17  3:36   ` Palmer Dabbelt
  0 siblings, 0 replies; 7+ messages in thread
From: Palmer Dabbelt @ 2021-03-17  3:36 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]

On Sun, 28 Feb 2021 03:10:22 PST (-0800), julia.lawall(a)inria.fr wrote:
> From: kernel test robot <lkp@intel.com>
>
> 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 <guoren@linux.alibaba.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> ---
>
> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] riscv: fix bugon.cocci warnings
  2021-02-27 19:46 arch/riscv/kernel/probes/kprobes.c:260:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG kernel test robot
@ 2021-02-27 19:46 ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2021-02-27 19:46 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1872 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Guo Ren <guoren@linux.alibaba.com>
CC: Palmer Dabbelt <palmerdabbelt@google.com>
CC: "Patrick Stählin" <me@packi.ch>
CC: Pekka Enberg <penberg@kernel.org>

From: kernel test robot <lkp@intel.com>

arch/riscv/kernel/probes/kprobes.c:260:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG.
Please make sure the condition has no side effects (see conditional BUG_ON definition in include/asm-generic/bug.h)

 Use BUG_ON instead of a if condition followed by BUG.

Semantic patch information:
 This makes an effort to find cases where BUG() follows an if
 condition on an expression and replaces the if condition and BUG()
 with a BUG_ON having the conditional expression of the if statement
 as argument.

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

Fixes: c22b0bcb1dd0 ("riscv: Add kprobes supported")
CC: Guo Ren <guoren@linux.alibaba.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

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

Please take the patch only if it's a positive warning. Thanks!

 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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-17  3:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-28 11:10 [PATCH] riscv: fix bugon.cocci warnings Julia Lawall
2021-02-28 11:10 ` Julia Lawall
2021-02-28 14:56 ` Pekka Enberg
2021-02-28 14:56   ` Pekka Enberg
2021-03-17  3:36 ` Palmer Dabbelt
2021-03-17  3:36   ` Palmer Dabbelt
  -- strict thread matches above, loose matches on Subject: below --
2021-02-27 19:46 arch/riscv/kernel/probes/kprobes.c:260:3-6: WARNING: Use BUG_ON instead of if condition followed by BUG kernel test robot
2021-02-27 19:46 ` [PATCH] riscv: fix bugon.cocci warnings kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.