From e1c171580117edd08f388dc4ae273c37bd9de8d2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 17 Feb 2016 13:13:45 +0300 Subject: [PATCH] states: only set the fake_stree in set_state() I'm trying to untangle how the fake stree is used so that it's a bit more explicit what's happening. The complicated bit of this patch is: - if (fake_cur_stree_stack) + if (fake_cur_stree_stack && owner != -1) The issue there is that this is called from Smatch implied like this: __push_fake_cur_stree(); __unnullify_path(); set_extra_nomod(name, sym, alloc_estate_rl(rl)); extra_states = __pop_fake_cur_stree(); If we don't allow -1 to go through then we can unnullify the path. Hm... That seems more complicated than necessary. Signed-off-by: Dan Carpenter --- smatch_states.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smatch_states.c b/smatch_states.c index 086585f2..5259c3fd 100644 --- a/smatch_states.c +++ b/smatch_states.c @@ -105,8 +105,8 @@ struct sm_state *set_state(int owner, const char *name, struct symbol *sym, stru if (owner != -1 && unreachable()) return NULL; - if (fake_cur_stree_stack) - set_state_stree_stack(&fake_cur_stree_stack, owner, name, sym, state); + if (fake_cur_stree_stack && owner != -1) + return set_state_stree_stack(&fake_cur_stree_stack, owner, name, sym, state); ret = set_state_stree(&cur_stree, owner, name, sym, state); -- 2.11.4.GIT