mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 21:52:04 +00:00
bpf: Don't use idx variable when registering kfunc dtors
In commitfda01efc61
("bpf: Enable cgroups to be used as kptrs"), I added an 'int idx' variable to kfunc_init() which was meant to dynamically set the index of the btf id entries of the 'generic_dtor_ids' array. This was done to make the code slightly less brittle as the struct cgroup * kptr kfuncs such as bpf_cgroup_aquire() are compiled out if CONFIG_CGROUPS is not defined. This, however, causes an lkp build warning: >> kernel/bpf/helpers.c:2005:40: warning: multiple unsequenced modifications to 'idx' [-Wunsequenced] .btf_id = generic_dtor_ids[idx++], Fix the warning by just hard-coding the indices. Fixes:fda01efc61
("bpf: Enable cgroups to be used as kptrs") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: David Vernet <void@manifault.com> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/r/20221123135253.637525-1-void@manifault.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
8a2162a922
commit
2fcc6081a7
@ -2019,16 +2019,16 @@ static const struct btf_kfunc_id_set common_kfunc_set = {
|
||||
|
||||
static int __init kfunc_init(void)
|
||||
{
|
||||
int ret, idx = 0;
|
||||
int ret;
|
||||
const struct btf_id_dtor_kfunc generic_dtors[] = {
|
||||
{
|
||||
.btf_id = generic_dtor_ids[idx++],
|
||||
.kfunc_btf_id = generic_dtor_ids[idx++]
|
||||
.btf_id = generic_dtor_ids[0],
|
||||
.kfunc_btf_id = generic_dtor_ids[1]
|
||||
},
|
||||
#ifdef CONFIG_CGROUPS
|
||||
{
|
||||
.btf_id = generic_dtor_ids[idx++],
|
||||
.kfunc_btf_id = generic_dtor_ids[idx++]
|
||||
.btf_id = generic_dtor_ids[2],
|
||||
.kfunc_btf_id = generic_dtor_ids[3]
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user