* [PATCH] libbpf: remove unneeded conversion to bool
@ 2021-11-25 0:54 davidcomponentone
2021-11-25 23:12 ` Daniel Borkmann
0 siblings, 1 reply; 6+ messages in thread
From: davidcomponentone @ 2021-11-25 0:54 UTC (permalink / raw)
To: ast, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Song Liu, Yonghong Song, John Fastabend, KP Singh
Cc: davidcomponentone, netdev, bpf, linux-kernel, Yang Guang, Zeal Robot
From: Yang Guang <yang.guang5@zte.com.cn>
The coccinelle report
./tools/lib/bpf/libbpf.c:1644:43-48:
WARNING: conversion to bool not needed here
Relational and logical operators evaluate to bool,
explicit conversion is overly verbose and unneeded.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 14a89dc99937..33eb365a0b7f 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1641,7 +1641,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
ext->name, value);
return -EINVAL;
}
- *(bool *)ext_val = value == 'y' ? true : false;
+ *(bool *)ext_val = value == 'y';
break;
case KCFG_TRISTATE:
if (value == 'y')
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] libbpf: remove unneeded conversion to bool
2021-11-25 0:54 [PATCH] libbpf: remove unneeded conversion to bool davidcomponentone
@ 2021-11-25 23:12 ` Daniel Borkmann
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2021-11-25 23:12 UTC (permalink / raw)
To: davidcomponentone, ast, Andrii Nakryiko, Martin KaFai Lau,
Song Liu, Yonghong Song, John Fastabend, KP Singh
Cc: netdev, bpf, linux-kernel, Yang Guang, Zeal Robot
On 11/25/21 1:54 AM, davidcomponentone@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> The coccinelle report
> ./tools/lib/bpf/libbpf.c:1644:43-48:
> WARNING: conversion to bool not needed here
> Relational and logical operators evaluate to bool,
> explicit conversion is overly verbose and unneeded.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Nak, dup of: https://lore.kernel.org/bpf/CAEf4BzaADXguVoh0KXxGYhzG68eA1bqfKH1T1SWyPvkE5BHa5g@mail.gmail.com/
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 14a89dc99937..33eb365a0b7f 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -1641,7 +1641,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
> ext->name, value);
> return -EINVAL;
> }
> - *(bool *)ext_val = value == 'y' ? true : false;
> + *(bool *)ext_val = value == 'y';
> break;
> case KCFG_TRISTATE:
> if (value == 'y')
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libbpf: Remove unneeded conversion to bool
2024-03-02 0:54 [PATCH] libbpf: Remove " Thorsten Blum
@ 2024-03-02 16:59 ` Yonghong Song
0 siblings, 0 replies; 6+ messages in thread
From: Yonghong Song @ 2024-03-02 16:59 UTC (permalink / raw)
To: Thorsten Blum, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
Cc: Martin KaFai Lau, Song Liu, John Fastabend, KP Singh,
Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf, linux-kernel
On 3/1/24 4:54 PM, Thorsten Blum wrote:
> Fixes Coccinelle/coccicheck warning reported by boolconv.cocci.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
See
https://lore.kernel.org/bpf/229F1668-2FE9-4B09-8314-DFB13B3D0A12@fb.com/
This has been discussed multiple times and recommendation is to keep it as is.
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index afd09571c482..2dda7a6c6f85 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -1801,7 +1801,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
> ext->name, value);
> return -EINVAL;
> }
> - *(bool *)ext_val = value == 'y' ? true : false;
> + *(bool *)ext_val = value == 'y';
> break;
> case KCFG_TRISTATE:
> if (value == 'y')
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] libbpf: Remove unneeded conversion to bool
@ 2024-03-02 0:54 Thorsten Blum
2024-03-02 16:59 ` Yonghong Song
0 siblings, 1 reply; 6+ messages in thread
From: Thorsten Blum @ 2024-03-02 0:54 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
Cc: Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
linux-kernel, Thorsten Blum
Fixes Coccinelle/coccicheck warning reported by boolconv.cocci.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index afd09571c482..2dda7a6c6f85 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1801,7 +1801,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
ext->name, value);
return -EINVAL;
}
- *(bool *)ext_val = value == 'y' ? true : false;
+ *(bool *)ext_val = value == 'y';
break;
case KCFG_TRISTATE:
if (value == 'y')
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] libbpf: remove unneeded conversion to bool
2022-01-14 0:07 davidcomponentone
@ 2022-01-14 0:37 ` Song Liu
0 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2022-01-14 0:37 UTC (permalink / raw)
To: davidcomponentone
Cc: Alexei Starovoitov, Daniel Borkmann, andrii, Martin Lau,
Yonghong Song, john.fastabend, kpsingh, netdev, bpf,
linux-kernel, Yang Guang, Zeal Robot
> On Jan 13, 2022, at 4:07 PM, davidcomponentone@gmail.com wrote:
>
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> The coccinelle report
> ./tools/lib/bpf/libbpf.c:1653:43-48:
> WARNING: conversion to bool not needed here
>
> Relational and logical operators evaluate to bool,
> explicit conversion is overly verbose and unneeded.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> Signed-off-by: David Yang <davidcomponentone@gmail.com>
I think this change has been NACK'ed multiple times.
I guess it is a good idea NOT to send it again.
Thanks,
Song
> ---
> tools/lib/bpf/libbpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 7f10dd501a52..f87787608795 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -1650,7 +1650,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
> ext->name, value);
> return -EINVAL;
> }
> - *(bool *)ext_val = value == 'y' ? true : false;
> + *(bool *)ext_val = value == 'y';
> break;
> case KCFG_TRISTATE:
> if (value == 'y')
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] libbpf: remove unneeded conversion to bool
@ 2022-01-14 0:07 davidcomponentone
2022-01-14 0:37 ` Song Liu
0 siblings, 1 reply; 6+ messages in thread
From: davidcomponentone @ 2022-01-14 0:07 UTC (permalink / raw)
To: ast
Cc: davidcomponentone, daniel, andrii, kafai, songliubraving, yhs,
john.fastabend, kpsingh, netdev, bpf, linux-kernel, Yang Guang,
Zeal Robot
From: Yang Guang <yang.guang5@zte.com.cn>
The coccinelle report
./tools/lib/bpf/libbpf.c:1653:43-48:
WARNING: conversion to bool not needed here
Relational and logical operators evaluate to bool,
explicit conversion is overly verbose and unneeded.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 7f10dd501a52..f87787608795 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1650,7 +1650,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
ext->name, value);
return -EINVAL;
}
- *(bool *)ext_val = value == 'y' ? true : false;
+ *(bool *)ext_val = value == 'y';
break;
case KCFG_TRISTATE:
if (value == 'y')
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-02 16:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25 0:54 [PATCH] libbpf: remove unneeded conversion to bool davidcomponentone
2021-11-25 23:12 ` Daniel Borkmann
2022-01-14 0:07 davidcomponentone
2022-01-14 0:37 ` Song Liu
2024-03-02 0:54 [PATCH] libbpf: Remove " Thorsten Blum
2024-03-02 16:59 ` Yonghong Song
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.