2020-04-14 05:44:32

by Zou Wei

[permalink] [raw]
Subject: [PATCH-next] bpf: Verifier, remove unneeded conversion to bool

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 <[email protected]>
Signed-off-by: Zou Wei <[email protected]>
---
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


2020-04-14 17:00:17

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH-next] bpf: Verifier, remove unneeded conversion to bool

On Mon, Apr 13, 2020 at 10:15 PM Zou Wei <[email protected]> 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 <[email protected]>
> Signed-off-by: Zou Wei <[email protected]>

Acked-by: Song Liu <[email protected]>

2020-04-15 21:54:54

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH-next] bpf: Verifier, remove unneeded conversion to bool

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 <[email protected]>
> Signed-off-by: Zou Wei <[email protected]>

Applied, thanks!