* [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data
@ 2022-11-13 20:52 David Michael
2022-11-14 17:21 ` sdf
2022-11-14 18:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: David Michael @ 2022-11-13 20:52 UTC (permalink / raw)
To: andrii; +Cc: bpf
GCC 11.3.0 fails to compile btf_dump.c due to the following error,
which seems to originate in btf_dump_struct_data where the returned
value would be uninitialized if btf_vlen returns zero.
btf_dump.c: In function ‘btf_dump_dump_type_data’:
btf_dump.c:2363:12: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
2363 | if (err < 0)
| ^
Fixes: 43174f0d4597 ("libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data")
Signed-off-by: David Michael <fedora.dm0@gmail.com>
---
Hi,
I encountered this build failure when using Gentoo's hardened profile to
build sys-kernel/gentoo-kernel (at least some 5.19 and 6.0 versions).
The following patch fixes it. Can this be applied?
Thanks.
David
tools/lib/bpf/btf_dump.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index 12f7039e0..e9f849d82 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -1989,7 +1989,7 @@ static int btf_dump_struct_data(struct btf_dump *d,
{
const struct btf_member *m = btf_members(t);
__u16 n = btf_vlen(t);
- int i, err;
+ int i, err = 0;
/* note that we increment depth before calling btf_dump_print() below;
* this is intentional. btf_dump_data_newline() will not print a
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data
2022-11-13 20:52 [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data David Michael
@ 2022-11-14 17:21 ` sdf
2022-11-14 17:54 ` Alan Maguire
2022-11-14 18:10 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: sdf @ 2022-11-14 17:21 UTC (permalink / raw)
To: David Michael; +Cc: andrii, bpf
On 11/13, David Michael wrote:
> GCC 11.3.0 fails to compile btf_dump.c due to the following error,
> which seems to originate in btf_dump_struct_data where the returned
> value would be uninitialized if btf_vlen returns zero.
> btf_dump.c: In function ‘btf_dump_dump_type_data’:
> btf_dump.c:2363:12: error: ‘err’ may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
> 2363 | if (err < 0)
> | ^
> Fixes: 43174f0d4597 ("libbpf: Silence uninitialized warning/error in
> btf_dump_dump_type_data")
Probably better to reference the original patch?
Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
Acked-by: Stanislav Fomichev <sdf@google.com>
> Signed-off-by: David Michael <fedora.dm0@gmail.com>
> ---
> Hi,
> I encountered this build failure when using Gentoo's hardened profile to
> build sys-kernel/gentoo-kernel (at least some 5.19 and 6.0 versions).
> The following patch fixes it. Can this be applied?
> Thanks.
> David
> tools/lib/bpf/btf_dump.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
> index 12f7039e0..e9f849d82 100644
> --- a/tools/lib/bpf/btf_dump.c
> +++ b/tools/lib/bpf/btf_dump.c
> @@ -1989,7 +1989,7 @@ static int btf_dump_struct_data(struct btf_dump *d,
> {
> const struct btf_member *m = btf_members(t);
> __u16 n = btf_vlen(t);
> - int i, err;
> + int i, err = 0;
> /* note that we increment depth before calling btf_dump_print() below;
> * this is intentional. btf_dump_data_newline() will not print a
> --
> 2.38.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data
2022-11-14 17:21 ` sdf
@ 2022-11-14 17:54 ` Alan Maguire
0 siblings, 0 replies; 4+ messages in thread
From: Alan Maguire @ 2022-11-14 17:54 UTC (permalink / raw)
To: sdf, David Michael; +Cc: andrii, bpf
On 14/11/2022 17:21, sdf@google.com wrote:
> On 11/13, David Michael wrote:
>> GCC 11.3.0 fails to compile btf_dump.c due to the following error,
>> which seems to originate in btf_dump_struct_data where the returned
>> value would be uninitialized if btf_vlen returns zero.
>
>> btf_dump.c: In function ‘btf_dump_dump_type_data’:
>> btf_dump.c:2363:12: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>> 2363 | if (err < 0)
>> | ^
>
>> Fixes: 43174f0d4597 ("libbpf: Silence uninitialized warning/error in btf_dump_dump_type_data")
>
> Probably better to reference the original patch?
> Fixes: 920d16af9b42 ("libbpf: BTF dumper support for typed data")
>
> Acked-by: Stanislav Fomichev <sdf@google.com>
>
Acked-by: Alan Maguire <alan.maguire@oracle.com>
Thanks for fixing!
>> Signed-off-by: David Michael <fedora.dm0@gmail.com>
>> ---
>
>> Hi,
>
>> I encountered this build failure when using Gentoo's hardened profile to
>> build sys-kernel/gentoo-kernel (at least some 5.19 and 6.0 versions).
>> The following patch fixes it. Can this be applied?
>
>> Thanks.
>
>> David
>
>> tools/lib/bpf/btf_dump.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>> diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
>> index 12f7039e0..e9f849d82 100644
>> --- a/tools/lib/bpf/btf_dump.c
>> +++ b/tools/lib/bpf/btf_dump.c
>> @@ -1989,7 +1989,7 @@ static int btf_dump_struct_data(struct btf_dump *d,
>> {
>> const struct btf_member *m = btf_members(t);
>> __u16 n = btf_vlen(t);
>> - int i, err;
>> + int i, err = 0;
>
>> /* note that we increment depth before calling btf_dump_print() below;
>> * this is intentional. btf_dump_data_newline() will not print a
>> --
>> 2.38.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data
2022-11-13 20:52 [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data David Michael
2022-11-14 17:21 ` sdf
@ 2022-11-14 18:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-14 18:10 UTC (permalink / raw)
To: David Michael; +Cc: andrii, bpf
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Sun, 13 Nov 2022 15:52:17 -0500 you wrote:
> GCC 11.3.0 fails to compile btf_dump.c due to the following error,
> which seems to originate in btf_dump_struct_data where the returned
> value would be uninitialized if btf_vlen returns zero.
>
> btf_dump.c: In function ‘btf_dump_dump_type_data’:
> btf_dump.c:2363:12: error: ‘err’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 2363 | if (err < 0)
> | ^
>
> [...]
Here is the summary with links:
- libbpf: Fix uninitialized warning in btf_dump_dump_type_data
https://git.kernel.org/bpf/bpf-next/c/dfd0afbf151d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-14 18:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-13 20:52 [PATCH] libbpf: Fix uninitialized warning in btf_dump_dump_type_data David Michael
2022-11-14 17:21 ` sdf
2022-11-14 17:54 ` Alan Maguire
2022-11-14 18:10 ` patchwork-bot+netdevbpf
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.