summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2020-09-07 06:58:45 -0700
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-09-18 13:16:40 -0400
commit46bbe5c671e06f070428b9be142cc4ee5cedebac (patch)
tree4a850c5d79dcd719ba0cc74654377baec83378b6
parent54fa9ba564b717fc2cf689427e195c360315999d (diff)
downloadlinux-riscv-46bbe5c671e06f070428b9be142cc4ee5cedebac.tar.gz
linux-riscv-46bbe5c671e06f070428b9be142cc4ee5cedebac.tar.bz2
linux-riscv-46bbe5c671e06f070428b9be142cc4ee5cedebac.zip
tracing: fix double free
clang static analyzer reports this problem trace_events_hist.c:3824:3: warning: Attempt to free released memory kfree(hist_data->attrs->var_defs.name[i]); In parse_var_defs() if there is a problem allocating var_defs.expr, the earlier var_defs.name is freed. This free is duplicated by free_var_defs() which frees the rest of the list. Because free_var_defs() has to run anyway, remove the second free fom parse_var_defs(). Link: https://lkml.kernel.org/r/20200907135845.15804-1-trix@redhat.com Cc: stable@vger.kernel.org Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers") Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_events_hist.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index 0b933546142e..1b2ef6490229 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -3865,7 +3865,6 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
s = kstrdup(field_str, GFP_KERNEL);
if (!s) {
- kfree(hist_data->attrs->var_defs.name[n_vars]);
ret = -ENOMEM;
goto free;
}