From 99acad7e9c675ea1487ebab6f3602551387dd1af Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 21 Dec 2015 18:51:54 +0300 Subject: [PATCH] data_source: don't print wrong sources The issue here is that say you have: void some_function(struct foo *p) { other_function(p->ptr); } We shouldn't say that some_function(param 0) is a source because it really comes from here. Maybe later we will trace that though? Like we could say "p $0->ptr"? But for now, no. Signed-off-by: Dan Carpenter --- smatch_data_source.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/smatch_data_source.c b/smatch_data_source.c index e2181530..9d1f3165 100644 --- a/smatch_data_source.c +++ b/smatch_data_source.c @@ -29,6 +29,10 @@ static char *get_source_parameter(struct expression *expr) char *ret = NULL; char buf[32]; + expr = strip_expr(expr); + if (expr->type != EXPR_SYMBOL) + return NULL; + name = expr_to_var_sym(expr, &sym); if (!name || !sym) goto free; -- 2.11.4.GIT