Message ID | 20220517095723.7426-1-ruc_gongyuanjun@163.com |
---|---|
State | New |
Headers | show |
Series | [1/1] tracing: fix possible null pointer dereference | expand |
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 44db5ba9cabb..73177c9f94b2 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -1576,11 +1576,11 @@ static void hist_elt_data_free(struct hist_elt_data *elt_data) { unsigned int i; - for (i = 0; i < elt_data->n_field_var_str; i++) - kfree(elt_data->field_var_str[i]); - - kfree(elt_data->field_var_str); - + if (elt_data->field_var_str) { + for (i = 0; i < elt_data->n_field_var_str; i++) + kfree(elt_data->field_var_str[i]); + kfree(elt_data->field_var_str); + } kfree(elt_data->comm); kfree(elt_data); }