diff mbox series

selftests: net: fix array_size.cocci warning

Message ID 20220305161835.16277-1-guozhengkui@vivo.com (mailing list archive)
State Accepted
Commit 0273d10182ec4507a43b868dd80fd62860b7e948
Headers show
Series selftests: net: fix array_size.cocci warning | expand

Commit Message

Guo Zhengkui March 5, 2022, 4:18 p.m. UTC
Fit the following coccicheck warning:
tools/testing/selftests/net/reuseport_bpf_numa.c:89:28-29:
WARNING: Use ARRAY_SIZE.

It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64.

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 tools/testing/selftests/net/reuseport_bpf_numa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 7, 2022, 12:30 p.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Sun,  6 Mar 2022 00:18:35 +0800 you wrote:
> Fit the following coccicheck warning:
> tools/testing/selftests/net/reuseport_bpf_numa.c:89:28-29:
> WARNING: Use ARRAY_SIZE.
> 
> It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64.
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> 
> [...]

Here is the summary with links:
  - selftests: net: fix array_size.cocci warning
    https://git.kernel.org/netdev/net-next/c/0273d10182ec

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/reuseport_bpf_numa.c b/tools/testing/selftests/net/reuseport_bpf_numa.c
index b2eebf669b8c..c9ba36aa688e 100644
--- a/tools/testing/selftests/net/reuseport_bpf_numa.c
+++ b/tools/testing/selftests/net/reuseport_bpf_numa.c
@@ -86,7 +86,7 @@  static void attach_bpf(int fd)
 
 	memset(&attr, 0, sizeof(attr));
 	attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
-	attr.insn_cnt = sizeof(prog) / sizeof(prog[0]);
+	attr.insn_cnt = ARRAY_SIZE(prog);
 	attr.insns = (unsigned long) &prog;
 	attr.license = (unsigned long) &bpf_license;
 	attr.log_buf = (unsigned long) &bpf_log_buf;