From c87f83f59b2648d96394bee5aef13f5f709cdcc6 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 20 Apr 2012 00:11:39 +0300 Subject: [PATCH] extra: foo((void *)&x) writes to x probably We need to strip away the cast to see the '&' operation. Signed-off-by: Dan Carpenter --- smatch_extra.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/smatch_extra.c b/smatch_extra.c index d8bb059f..655366a7 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -387,14 +387,16 @@ static struct smatch_state *unmatched_state(struct sm_state *sm) static void match_function_call(struct expression *expr) { + struct expression *arg; struct expression *tmp; - FOR_EACH_PTR(expr->args, tmp) { + FOR_EACH_PTR(expr->args, arg) { + tmp = strip_expr(arg); if (tmp->type == EXPR_PREOP && tmp->op == '&') { remove_from_equiv_expr(tmp->unop); set_state_expr(SMATCH_EXTRA, tmp->unop, extra_undefined()); } - } END_FOR_EACH_PTR(tmp); + } END_FOR_EACH_PTR(arg); } static void match_assign(struct expression *expr) -- 2.11.4.GIT