diff mbox series

bpf: Initialize ret to 0 inside btf_populate_kfunc_set()

Message ID 20220219163915.125770-1-jrdr.linux@gmail.com (mailing list archive)
State Accepted
Commit d0b3822902b6af45f2c75706d7eb2a35aacab223
Delegated to: BPF
Headers show
Series bpf: Initialize ret to 0 inside btf_populate_kfunc_set() | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next fail VM_Test
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Souptick Joarder Feb. 19, 2022, 4:39 p.m. UTC
From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>

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")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
---
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kumar Kartikeya Dwivedi Feb. 20, 2022, 12:42 a.m. UTC | #1
On Sat, Feb 19, 2022 at 10:09:15PM IST, Souptick Joarder wrote:
> From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
>
> 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")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
> ---

Thanks for the fix.

Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>

>  kernel/bpf/btf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 02d7014417a0..2c4c5dbe2abe 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -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])
> --
> 2.25.1
>

--
Kartikeya
Alexei Starovoitov Feb. 20, 2022, 1:39 a.m. UTC | #2
On Sat, Feb 19, 2022 at 4:42 PM Kumar Kartikeya Dwivedi
<memxor@gmail.com> wrote:
>
> On Sat, Feb 19, 2022 at 10:09:15PM IST, Souptick Joarder wrote:
> > From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
> >
> > 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")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
> > ---
>
> Thanks for the fix.
>
> Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>

Applied to bpf-next, since the bug will not trigger in practice.
patchwork-bot+netdevbpf@kernel.org Feb. 20, 2022, 1:40 a.m. UTC | #3
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Sat, 19 Feb 2022 22:09:15 +0530 you wrote:
> From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
> 
> 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!
diff mbox series

Patch

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 02d7014417a0..2c4c5dbe2abe 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -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])