File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1016,10 +1016,13 @@ static int write_bpf_prog_info(struct feat_fd *ff,
10161016 struct perf_env * env = & ff -> ph -> env ;
10171017 struct rb_root * root ;
10181018 struct rb_node * next ;
1019- int ret ;
1019+ int ret = 0 ;
10201020
10211021 down_read (& env -> bpf_progs .lock );
10221022
1023+ if (env -> bpf_progs .infos_cnt == 0 )
1024+ goto out ;
1025+
10231026 ret = do_write (ff , & env -> bpf_progs .infos_cnt ,
10241027 sizeof (env -> bpf_progs .infos_cnt ));
10251028 if (ret < 0 )
@@ -1058,10 +1061,13 @@ static int write_bpf_btf(struct feat_fd *ff,
10581061 struct perf_env * env = & ff -> ph -> env ;
10591062 struct rb_root * root ;
10601063 struct rb_node * next ;
1061- int ret ;
1064+ int ret = 0 ;
10621065
10631066 down_read (& env -> bpf_progs .lock );
10641067
1068+ if (env -> bpf_progs .btfs_cnt == 0 )
1069+ goto out ;
1070+
10651071 ret = do_write (ff , & env -> bpf_progs .btfs_cnt ,
10661072 sizeof (env -> bpf_progs .btfs_cnt ));
10671073
You can’t perform that action at this time.
0 commit comments