Skip to contentSkip to conversation

bpf: Initialize ret to 0 inside btf_populate_kfunc_set()

PATCH Applied Souptick Joarder 4 participants 4 messages Feb 19, 2022 – Feb 20, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Initialize ret to 0 inside btf_populate_kfunc_set()

From: "Souptick Joarder (HPE)" <[email protected]>

Kernel test robot reported below error ->

kernel/bpf/btf.c:6718 btf_populate_kfunc_set()
error: uninitialized symbol 'ret'.

Initialize ret to 0.

Fixes dee872e124e8 ("bpf: Populate kfunc BTF ID sets in struct btf")
---
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/btf.c +1 -1
index 02d7014417a0..2c4c5dbe2abe 100644
@@ -6706,7 +6706,7 @@ static int btf_populate_kfunc_set(struct btf *btf, enum btf_kfunc_hook hook,
 				  const struct btf_kfunc_id_set *kset)
 {
 	bool vmlinux_set = !btf_is_module(btf);
-	int type, ret;
+	int type, ret = 0;
 
 	for (type = 0; type < ARRAY_SIZE(kset->sets); type++) {
 		if (!kset->sets[type])
Signature · 1 line
2.25.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Souptick Joarder

From: "Souptick Joarder (HPE)" <[email protected]>

Kernel test robot reported below error ->

kernel/bpf/btf.c:6718 btf_populate_kfunc_set()
error: uninitialized symbol 'ret'.

Quoted 6 lines

Initialize ret to 0.

Fixes dee872e124e8 ("bpf: Populate kfunc BTF ID sets in struct btf")

---

Thanks for the fix.

Quoted 17 lines
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/btf.c +1 -2
index 02d7014417a0..2c4c5dbe2abe 100644
@@ -6706,7 +6706,7 @@ static int btf_populate_kfunc_set(struct btf *btf, enum btf_kfunc_hook hook,
 				  const struct btf_kfunc_id_set *kset)
 {
 	bool vmlinux_set = !btf_is_module(btf);
-	int type, ret;
+	int type, ret = 0;
 
 	for (type = 0; type < ARRAY_SIZE(kset->sets); type++) {
 		if (!kset->sets[type])
--
Quoted 2 lines

2.25.1

--
Kartikeya

#2 lore raw
Quoted 11 lines · Kumar Kartikeya Dwivedi
Quoted 9 lines · Souptick Joarder

From: "Souptick Joarder (HPE)" <[email protected]>

Kernel test robot reported below error ->

kernel/bpf/btf.c:6718 btf_populate_kfunc_set()
error: uninitialized symbol 'ret'.

Initialize ret to 0.

Quoted 8 lines
Quoted 4 lines
Fixes dee872e124e8 ("bpf: Populate kfunc BTF ID sets in struct btf")

---

Thanks for the fix.

Applied to bpf-next, since the bug will not trigger in practice.

#3 lore raw
In reply to Souptick Joarder
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 8 lines · On Sat, 19 Feb 2022 22:09:15 +0530 you wrote:

From: "Souptick Joarder (HPE)" <[email protected]>

Kernel test robot reported below error ->

kernel/bpf/btf.c:6718 btf_populate_kfunc_set()
error: uninitialized symbol 'ret'.

[...]

Here is the summary with links:
- bpf: Initialize ret to 0 inside btf_populate_kfunc_set()

    https://git.kernel.org/bpf/bpf-next/c/d0b3822902b6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html