Skip to content

Commit 1dfa329

Browse files
author
Dan Carpenter
committed
extra: handle the PARAM_DEREFERENCED hook earlier
One thing which happens is that we dereference a parameter and then set it. The dereference should be processed first. Otherwise if it's processed second maybe we set the parameter to NULL, and then processing the dereference means it can't be NULL so now it's an impossible state. Also it makes no sense to process dereferences afterwards. There is nothing to be gained from that. The PARAM_SET will hopefully say that it must be valid and that's the end of that. Signed-off-by: Dan Carpenter <[email protected]>
1 parent 5d14cc0 commit 1dfa329

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

smatch_extra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2997,7 +2997,7 @@ void register_smatch_extra_late(int id)
29972997
add_modification_hook(link_id, &match_link_modify);
29982998
add_hook(&match_dereferences, DEREF_HOOK);
29992999
add_hook(&match_pointer_as_array, OP_HOOK);
3000-
select_return_implies_hook(DEREFERENCE, &set_param_dereferenced);
3000+
select_return_implies_hook_early(DEREFERENCE, &set_param_dereferenced);
30013001
add_hook(&match_function_call, FUNCTION_CALL_HOOK);
30023002
add_hook(&match_assign, ASSIGNMENT_HOOK);
30033003
add_hook(&match_assign, GLOBAL_ASSIGNMENT_HOOK);

0 commit comments

Comments
 (0)