All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] libbpf: Make btf_name_info.needs_size unsigned
@ 2024-06-27  9:09 Ilya Leoshkevich
  2024-06-27 15:02 ` Alan Maguire
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Leoshkevich @ 2024-06-27  9:09 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Ilya Leoshkevich

Clang build of libbpf fails with:

tools/lib/bpf/btf_relocate.c:206:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
  206 |                 info[id].needs_size = true;
      |                                     ^ ~~~~

Resolve the issue by making needs_size unsigned.

Fixes: 19e00c897d50 ("libbpf: Split BTF relocation")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/lib/bpf/btf_relocate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/btf_relocate.c b/tools/lib/bpf/btf_relocate.c
index 2281dbbafa11..d2551d7f33c8 100644
--- a/tools/lib/bpf/btf_relocate.c
+++ b/tools/lib/bpf/btf_relocate.c
@@ -58,7 +58,7 @@ struct btf_relocate {
 struct btf_name_info {
 	const char *name;
 	/* set when search requires a size match */
-	int needs_size:1,
+	unsigned needs_size:1,
 	    size:31;
 	__u32 id;
 };
-- 
2.45.2


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

* Re: [PATCH bpf-next] libbpf: Make btf_name_info.needs_size unsigned
  2024-06-27  9:09 [PATCH bpf-next] libbpf: Make btf_name_info.needs_size unsigned Ilya Leoshkevich
@ 2024-06-27 15:02 ` Alan Maguire
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Maguire @ 2024-06-27 15:02 UTC (permalink / raw)
  To: Ilya Leoshkevich, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko
  Cc: bpf, Heiko Carstens, Vasily Gorbik, Alexander Gordeev

On 27/06/2024 10:09, Ilya Leoshkevich wrote:
> Clang build of libbpf fails with:
> 
> tools/lib/bpf/btf_relocate.c:206:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
>   206 |                 info[id].needs_size = true;
>       |                                     ^ ~~~~
> 
> Resolve the issue by making needs_size unsigned.
> 
> Fixes: 19e00c897d50 ("libbpf: Split BTF relocation")
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

Thanks for the fix! This one should already be resolved in bpf-next via

0f31c2c61f69 ("libbpf: Fix clang compilation error in btf_relocate.c")

> ---
>  tools/lib/bpf/btf_relocate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/lib/bpf/btf_relocate.c b/tools/lib/bpf/btf_relocate.c
> index 2281dbbafa11..d2551d7f33c8 100644
> --- a/tools/lib/bpf/btf_relocate.c
> +++ b/tools/lib/bpf/btf_relocate.c
> @@ -58,7 +58,7 @@ struct btf_relocate {
>  struct btf_name_info {
>  	const char *name;
>  	/* set when search requires a size match */
> -	int needs_size:1,
> +	unsigned needs_size:1,
>  	    size:31;
>  	__u32 id;
>  };

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

end of thread, other threads:[~2024-06-27 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27  9:09 [PATCH bpf-next] libbpf: Make btf_name_info.needs_size unsigned Ilya Leoshkevich
2024-06-27 15:02 ` Alan Maguire

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.