From 7bf65c33053fd45fecc9649810a9d670898eb602 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 5 Oct 2017 10:34:56 +0300 Subject: [PATCH] extra: delete match_untracked_array() I'm not sure using smatch_untracked is appropriate here. Say we pass a pointer "p" to a function assigned "foo->bar = p;" then we mark that as untracked. And sure, we *might* lose track of it, but mostly likely it's just saved for later and not changed. So it's better to assume that we still know the value of "p->x;" or whatever. This fixes a false postive: drivers/media/usb/pulse8-cec/pulse8-cec.c:685 pulse8_connect() error: 'pulse8->adap' dereferencing possible ERR_PTR() The check uses smatch_extra to see if a variable can possibly be in the error pointer range, so in the original code smatch_extra says "I don't know, it could be anything". Signed-off-by: Dan Carpenter --- smatch_extra.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/smatch_extra.c b/smatch_extra.c index dfd7700c..08575260 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -789,16 +789,6 @@ static void do_array_assign(struct expression *left, int op, struct expression * set_extra_array_mod(left, alloc_estate_rl(rl)); } -static void match_untracked_array(struct expression *call, int param) -{ - struct expression *arg; - - arg = get_argument_from_call_expr(call->args, param); - arg = strip_expr(arg); - - clear_array_states(arg); -} - static void match_vanilla_assign(struct expression *left, struct expression *right) { struct range_list *orig_rl = NULL; @@ -2529,7 +2519,6 @@ void register_smatch_extra_late(int id) add_hook(&match_assign, GLOBAL_ASSIGNMENT_HOOK); add_hook(&unop_expr, OP_HOOK); add_hook(&asm_expr, ASM_HOOK); - add_untracked_param_hook(&match_untracked_array); add_hook(&match_call_info, FUNCTION_CALL_HOOK); add_member_info_callback(my_id, struct_member_callback); -- 2.11.4.GIT