From 1c5f3ea4008392ab9e1346078c2de3e20eed6ee4 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 8 Apr 2013 09:41:51 +0300 Subject: [PATCH] implied: db: fix how returns are broken apart This function is used in db to process code like this: err = some_func(); if (err) goto err_out; ... err = some_other_func(); if (err) goto err_out; return 0; err_out: cleanup(); return err; At the end, "err" could be a bunch of different error code. If we treat it like one thing then we could lose information compared to the code returned directly after each failure. So what we do is we look at all the sources of "err" where "err" came from. We take the implications of each error return. This function is looking at the implications to see which of the old states have been changed. It checks the wrong variable so it says none of the states have been modified. So each return is like a direct return without any additional clean up work being done. Signed-off-by: Dan Carpenter --- smatch_implied.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smatch_implied.c b/smatch_implied.c index 2c39384e..502fa8f3 100644 --- a/smatch_implied.c +++ b/smatch_implied.c @@ -637,7 +637,7 @@ static int sm_state_in_slist(struct sm_state *sm, struct state_list *slist) { struct sm_state *tmp; - FOR_EACH_PTR(sm->pool, tmp) { + FOR_EACH_PTR(slist, tmp) { if (tmp == sm) return 1; } END_FOR_EACH_PTR(tmp); -- 2.11.4.GIT