diff options
author | Rongguang Wei <weirongguang@kylinos.cn> | 2022-07-26 11:30:45 +0200 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2022-07-29 19:40:51 +0200 |
commit | 5eff8c18f124e47da0be79fb2b776e1c2cac0b07 (patch) | |
tree | eea924fb22caecc8a815801ffd8338247afcda8f /tools/bpf/bpftool/prog.c | |
parent | bpf: btf: Fix vsnprintf return value check (diff) | |
download | linux-5eff8c18f124e47da0be79fb2b776e1c2cac0b07.tar.xz linux-5eff8c18f124e47da0be79fb2b776e1c2cac0b07.zip |
bpftool: Replace sizeof(arr)/sizeof(arr[0]) with ARRAY_SIZE macro
Use the ARRAY_SIZE macro and make the code more compact.
Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20220726093045.3374026-1-clementwei90@163.com
Diffstat (limited to '')
-rw-r--r-- | tools/bpf/bpftool/prog.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index f081de398b60..c81362a001ba 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -1962,7 +1962,7 @@ static int profile_parse_metrics(int argc, char **argv) int selected_cnt = 0; unsigned int i; - metric_cnt = sizeof(metrics) / sizeof(struct profile_metric); + metric_cnt = ARRAY_SIZE(metrics); while (argc > 0) { for (i = 0; i < metric_cnt; i++) { |