[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211117132024.11509-1-guozhengkui@vivo.com>
Date: Wed, 17 Nov 2021 21:20:21 +0800
From: Guo Zhengkui <guozhengkui@...o.com>
To: Shuah Khan <shuah@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Guo Zhengkui <guozhengkui@...o.com>,
Yucong Sun <sunyucong@...il.com>,
Dave Marchevsky <davemarchevsky@...com>,
linux-kselftest@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: kernel@...o.com
Subject: [PATCH] selftests/bpf: fix array_size.cocci warning:
Use ARRAY_SIZE() because it uses __must_be_array(arr) to make sure
arr is really an array.
Signed-off-by: Guo Zhengkui <guozhengkui@...o.com>
---
.../testing/selftests/bpf/prog_tests/cgroup_attach_override.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c
index 356547e849e2..1921c5040d8c 100644
--- a/tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c
+++ b/tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/kernel.h>
#include <test_progs.h>
#include "cgroup_helpers.h"
@@ -16,10 +17,9 @@ static int prog_load(int verdict)
BPF_MOV64_IMM(BPF_REG_0, verdict), /* r0 = verdict */
BPF_EXIT_INSN(),
};
- size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
return bpf_test_load_program(BPF_PROG_TYPE_CGROUP_SKB,
- prog, insns_cnt, "GPL", 0,
+ prog, ARRAY_SIZE(prog), "GPL", 0,
bpf_log_buf, BPF_LOG_BUF_SIZE);
}
--
2.20.1
Powered by blists - more mailing lists