tracing: Fix a potential NULL dereference
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Mar 2018 11:37:36 +0000 (14:37 +0300)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 23 Mar 2018 15:15:20 +0000 (11:15 -0400)
We forgot to set the error code on this path so we return ERR_PTR(0)
which is NULL.  It results in a NULL dereference in the caller.

Link: http://lkml.kernel.org/r/20180323113735.GC28518@mwanda
Fixes: 100719dcef44 ("tracing: Add simple expression support to hist triggers")
Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_hist.c

index 4f02764..a02bc09 100644 (file)
@@ -2776,6 +2776,7 @@ static struct hist_field *parse_expr(struct hist_trigger_data *hist_data,
                expr->fn = hist_field_plus;
                break;
        default:
+               ret = -EINVAL;
                goto free;
        }