Re: [PATCH bpf-next v3 2/2] bpftool: Fix sparse CPU IDs in prog profile
From: bot+bpf-ci
Date: Tue Sep 22 2026 - 21:28:10 EST
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index 000774835b10..24e40dfab469 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
[ ... ]
> @@ -2394,6 +2397,7 @@ static void profile_close_perf_events(void)
> close(profile_perf_events[i]);
>
> free(profile_perf_events);
> + profile_perf_events = NULL;
> profile_perf_event_cnt = 0;
> }
This isn't a bug, but is the new 'profile_perf_events = NULL;' needed
for the sparse-CPU fix, or would it read better as its own patch (or at
least a changelog line), since the rest of the hunk set is about CPU
IDs?
[ ... ]
> @@ -2486,6 +2491,10 @@ static int profile_print_and_cleanup(void)
>
> close(profile_tgt_fd);
> free(profile_tgt_name);
> + free(profile_cpu_ids);
> + profile_cpu_ids = NULL;
> + profile_cpu_cnt = 0;
> + profile_cpu_id_span = 0;
> return err;
> }
[ ... ]
> @@ -2589,6 +2600,10 @@ static int do_profile(int argc, char **argv)
> profiler_bpf__destroy(profile_obj);
> close(profile_tgt_fd);
> free(profile_tgt_name);
> + free(profile_cpu_ids);
> + profile_cpu_ids = NULL;
> + profile_cpu_cnt = 0;
> + profile_cpu_id_span = 0;
> return err;
> }
This isn't a bug, but could the 'profile_cpu_cnt = 0' /
'profile_cpu_id_span = 0' stores be dropped, given nothing reads them
after either return and the adjacent statics (profile_tgt_name,
profile_obj) are left alone?
[ ... ]
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35804155043