From ad619d0cbe64ae8c75fd9219faa1718488e1b783 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 14 Feb 2009 00:13:17 +0300 Subject: [PATCH] Return &merged instead of &undefined. This changes how smatch_implied figures things out. Really this check needs to have the merge hook removed entirely. Signed-off-by: Dan Carpenter --- check_null_deref.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/check_null_deref.c b/check_null_deref.c index 7155200f..0fb759c3 100644 --- a/check_null_deref.c +++ b/check_null_deref.c @@ -67,7 +67,7 @@ static struct smatch_state *merge_func(const char *name, struct symbol *sym, return &assumed_nonnull; if (s1 == &argument && s2 == &nonnull) return &nonnull; - return &undefined; + return &merged; } static struct func_n_param *alloc_func_n_param(struct symbol *func, int param, @@ -154,7 +154,8 @@ static void match_function_call_after(struct expression *expr) } else { name = get_variable_from_expr(tmp, &sym); if (func && name && sym) { - if (get_state(name, my_id, sym) == &undefined) + if (get_state(name, my_id, sym) == &undefined || + get_state(name, my_id, sym) == &merged) add_param(&calls, func, i, get_lineno()); } else free_string(name); @@ -237,7 +238,7 @@ static void set_new_true_false_states(const char *name, int my_id, SM_DEBUG("set_new_stuff called at %d value='%s'\n", get_lineno(), show_state(tmp)); - if (!tmp || tmp == &undefined || tmp == &isnull || tmp == &argument) + if (!tmp || tmp == &undefined || tmp == &merged || tmp == &isnull || tmp == &argument) set_true_false_states(name, my_id, sym, true_state, false_state); } @@ -315,7 +316,7 @@ static void match_dereferences(struct expression *expr) return; state = get_state(deref, my_id, sym); - if (state == &undefined) { + if (state == &undefined || state == &merged) { smatch_msg("Dereferencing Undefined: '%s'", deref); set_state(deref, my_id, sym, &ignore); } else if (state == &isnull) { -- 2.11.4.GIT