From 4f39c62f67e2482b2cb76e8582e3e06308990986 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 3 Oct 2012 09:49:41 +0300 Subject: [PATCH] dereferences_param: handle strcmp() strcmp() takes the parameter, stores it as "p" and then dereferences it. Signed-off-by: Dan Carpenter --- check_dereferences_param.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/check_dereferences_param.c b/check_dereferences_param.c index d05f97f3..71ccf7d0 100644 --- a/check_dereferences_param.c +++ b/check_dereferences_param.c @@ -7,6 +7,12 @@ * */ +/* + * This is an --info recipe. The goal is to print a message for every parameter + * which we can not avoid dereferencing. This is maybe a bit restrictive but it + * avoids some false positives. + */ + #include "smatch.h" #include "smatch_extra.h" #include "smatch_slist.h" @@ -54,8 +60,12 @@ static void match_function_def(struct symbol *sym) static void check_deref(struct expression *expr) { + struct expression *tmp; struct sm_state *sm; + tmp = get_assigned_expr(expr); + if (tmp) + expr = tmp; expr = strip_expr(expr); if (!is_arg(expr)) -- 2.11.4.GIT