bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-next] bpf: Verifier, remove unneeded conversion to bool
@ 2020-04-13 11:57 Zou Wei
  2020-04-14 16:50 ` Song Liu
  2020-04-14 19:45 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Zou Wei @ 2020-04-13 11:57 UTC (permalink / raw)
  To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
	kpsingh, netdev, bpf, linux-kernel
  Cc: Zou Wei

This issue was detected by using the Coccinelle software:

kernel/bpf/verifier.c:1259:16-21: WARNING: conversion to bool not needed here

The conversion to bool is unneeded, remove it

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 kernel/bpf/verifier.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 04c6630..38cfcf7 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -1255,8 +1255,7 @@ static void __mark_reg_unknown(const struct bpf_verifier_env *env,
 	reg->type = SCALAR_VALUE;
 	reg->var_off = tnum_unknown;
 	reg->frameno = 0;
-	reg->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks ?
-		       true : false;
+	reg->precise = env->subprog_cnt > 1 || !env->allow_ptr_leaks;
 	__mark_reg_unbounded(reg);
 }
 
-- 
2.6.2


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

* Re: [PATCH-next] bpf: Verifier, remove unneeded conversion to bool
  2020-04-13 11:57 [PATCH-next] bpf: Verifier, remove unneeded conversion to bool Zou Wei
@ 2020-04-14 16:50 ` Song Liu
  2020-04-14 19:45 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2020-04-14 16:50 UTC (permalink / raw)
  To: Zou Wei
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh,
	Networking, bpf, open list

On Mon, Apr 13, 2020 at 10:15 PM Zou Wei <zou_wei@huawei.com> wrote:
>
> This issue was detected by using the Coccinelle software:
>
> kernel/bpf/verifier.c:1259:16-21: WARNING: conversion to bool not needed here
>
> The conversion to bool is unneeded, remove it
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>

Acked-by: Song Liu <songliubraving@fb.com>

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

* Re: [PATCH-next] bpf: Verifier, remove unneeded conversion to bool
  2020-04-13 11:57 [PATCH-next] bpf: Verifier, remove unneeded conversion to bool Zou Wei
  2020-04-14 16:50 ` Song Liu
@ 2020-04-14 19:45 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2020-04-14 19:45 UTC (permalink / raw)
  To: Zou Wei, ast, kafai, songliubraving, yhs, andriin,
	john.fastabend, kpsingh, netdev, bpf, linux-kernel

On 4/13/20 1:57 PM, Zou Wei wrote:
> This issue was detected by using the Coccinelle software:
> 
> kernel/bpf/verifier.c:1259:16-21: WARNING: conversion to bool not needed here
> 
> The conversion to bool is unneeded, remove it
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>

Applied, thanks!

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

end of thread, other threads:[~2020-04-14 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-13 11:57 [PATCH-next] bpf: Verifier, remove unneeded conversion to bool Zou Wei
2020-04-14 16:50 ` Song Liu
2020-04-14 19:45 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).