mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
perf header: Don't write empty BPF/BTF info
If there are no values in bpf_prog_info or bpf_btf feature don't write the data into the header. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250617223356.2752099-4-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -1016,10 +1016,13 @@ static int write_bpf_prog_info(struct feat_fd *ff,
|
||||
struct perf_env *env = &ff->ph->env;
|
||||
struct rb_root *root;
|
||||
struct rb_node *next;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
down_read(&env->bpf_progs.lock);
|
||||
|
||||
if (env->bpf_progs.infos_cnt == 0)
|
||||
goto out;
|
||||
|
||||
ret = do_write(ff, &env->bpf_progs.infos_cnt,
|
||||
sizeof(env->bpf_progs.infos_cnt));
|
||||
if (ret < 0)
|
||||
@@ -1058,10 +1061,13 @@ static int write_bpf_btf(struct feat_fd *ff,
|
||||
struct perf_env *env = &ff->ph->env;
|
||||
struct rb_root *root;
|
||||
struct rb_node *next;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
down_read(&env->bpf_progs.lock);
|
||||
|
||||
if (env->bpf_progs.btfs_cnt == 0)
|
||||
goto out;
|
||||
|
||||
ret = do_write(ff, &env->bpf_progs.btfs_cnt,
|
||||
sizeof(env->bpf_progs.btfs_cnt));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user