Message ID | 20220417185630.199062-2-ammarfaizi2@gnuweeb.org (mailing list archive) |
---|---|
State | Accepted |
Commit | b2eb95301cca55069bca82b77ad8d9a55be63b94 |
Headers | show |
Series | Two tracing patches for trace_events_hist.c | expand |
diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 44db5ba9cabb..0b99ad68e3fa 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -6186,7 +6186,8 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops, lockdep_assert_held(&event_mutex); - WARN_ON(!glob); + if (WARN_ON(!glob)) + return -EINVAL; if (strlen(glob)) { hist_err_clear();
If `WARN_ON(!glob)` is ever triggered, we will still continue executing the next lines. This will trigger the more serious problem, a NULL pointer dereference bug. Just return -EINVAL if @glob is NULL. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> --- kernel/trace/trace_events_hist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)