mirror of
https://github.com/netdata/libbpf.git
synced 2026-11-09 04:10:13 +08:00
libbpf: Fix array_size.cocci warning
Fix the following coccicheck warning: tools/lib/bpf/bpf.c:114:31-32: WARNING: Use ARRAY_SIZE tools/lib/bpf/xsk.c:484:34-35: WARNING: Use ARRAY_SIZE tools/lib/bpf/xsk.c:485:35-36: 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> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20220306023426.19324-1-guozhengkui@vivo.com
This commit is contained in:
1 parent
6e77ef94f0
commit
21cd83a1d1
2 files changed
+4
-3
No files matched your search
@@ -29,6 +29,7 @@
|
||||
#include <errno.h>
|
||||
#include <linux/bpf.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <limits.h>
|
||||
#include <sys/resource.h>
|
||||
#include "bpf.h"
|
||||
@@ -111,7 +112,7 @@ int probe_memcg_account(void)
|
||||
BPF_EMIT_CALL(BPF_FUNC_ktime_get_coarse_ns),
|
||||
BPF_EXIT_INSN(),
|
||||
};
|
||||
size_t insn_cnt = sizeof(insns) / sizeof(insns[0]);
|
||||
size_t insn_cnt = ARRAY_SIZE(insns);
|
||||
union bpf_attr attr;
|
||||
int prog_fd;
|
||||
|
||||
|
||||
Reference in new issue
Block a user