From: Dan Carpenter Date: Fri, 28 Jun 2013 13:27:54 +0000 (+0300) Subject: db: track some more ==p1 return values X-Git-Tag: 1.59~23 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/7f4102317b479921197f2fd9a8352c81a759cb22 db: track some more ==p1 return values The problem here is that the code thinks it can split apart the return value into something meaningful because it knows how the function was called. But actually the parameter has not been modified within the function. So instead of splitting it apart just return that it is equal to a parameter. I added some NULL checks for void functions so we don't crash. Signed-off-by: Dan Carpenter --- diff --git a/smatch_comparison.c b/smatch_comparison.c index a6bfea93..44c7d7fe 100644 --- a/smatch_comparison.c +++ b/smatch_comparison.c @@ -544,6 +544,8 @@ static char *chunk_to_var_sym(struct expression *expr, struct symbol **sym) char buf[128]; expr = strip_expr(expr); + if (!expr) + return NULL; if (sym) *sym = NULL; diff --git a/smatch_db.c b/smatch_db.c index 9be9f54e..a09c0e1c 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -797,6 +797,9 @@ static int call_return_state_hooks_split_possible(struct expression *expr) char *compare_str; char buf[128]; + if (!expr || expr_equal_to_param(expr)) + return 0; + sm = get_sm_state_expr(SMATCH_EXTRA, expr); if (!sm || !sm->merged) return 0;