From ade1378eaee75897de8217fddcb91d38bd652628 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 25 Jul 2017 17:49:44 +0300 Subject: [PATCH] db: don't split NULL/non-NULL returns for reason Before we were just generating duplicate states for unknown returns. It was a waste of space. Signed-off-by: Dan Carpenter --- smatch_db.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/smatch_db.c b/smatch_db.c index 33dc9d5d..ad088bf2 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -1181,6 +1181,7 @@ static int call_return_state_hooks_split_null_non_null(struct expression *expr) sval_t null_sval; struct range_list *null_rl = NULL; char *return_ranges; + struct sm_state *sm; struct smatch_state *state; int nr_states; int final_pass_orig = final_pass; @@ -1192,8 +1193,13 @@ static int call_return_state_hooks_split_null_non_null(struct expression *expr) if (!is_pointer(expr)) return 0; - state = get_state_expr(SMATCH_EXTRA, expr); - if (!state || !estate_rl(state)) + sm = get_sm_state_expr(SMATCH_EXTRA, expr); + if (!sm) + return 0; + if (ptr_list_size((struct ptr_list *)sm->possible) == 1) + return 0; + state = sm->state; + if (!estate_rl(state)) return 0; if (estate_min(state).value == 0 && estate_max(state).value == 0) return 0; -- 2.11.4.GIT