diff options
author | Guo Zhengkui <guozhengkui@vivo.com> | 2022-03-15 16:01:26 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-03-15 19:03:10 +0300 |
commit | f98d6dd1e79d4b04c2e13e91a9348473cfa805a6 (patch) | |
tree | 75ac48a710e482fbff0424c22a25addd29fc2075 /tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c | |
parent | 8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0 (diff) | |
download | linux-f98d6dd1e79d4b04c2e13e91a9348473cfa805a6.tar.xz |
selftests/bpf: Clean up array_size.cocci warnings
Clean up the array_size.cocci warnings under tools/testing/selftests/bpf/:
Use `ARRAY_SIZE(arr)` instead of forms like `sizeof(arr)/sizeof(arr[0])`.
tools/testing/selftests/bpf/test_cgroup_storage.c uses ARRAY_SIZE() defined
in tools/include/linux/kernel.h (sys/sysinfo.h -> linux/kernel.h), while
others use ARRAY_SIZE() in bpf_util.h.
Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220315130143.2403-1-guozhengkui@vivo.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c index 38b3c47293da..db0b7bac78d1 100644 --- a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c +++ b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c @@ -63,7 +63,7 @@ static int prog_load_cnt(int verdict, int val) BPF_MOV64_IMM(BPF_REG_0, verdict), /* r0 = verdict */ BPF_EXIT_INSN(), }; - size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn); + size_t insns_cnt = ARRAY_SIZE(prog); int ret; ret = bpf_test_load_program(BPF_PROG_TYPE_CGROUP_SKB, |