function_hooks: hack around fallout from moving the assignment to the end
commit79fe36620a7a3a45d1a51d62238da250fb8db920
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 26 Sep 2018 12:47:29 +0000 (26 15:47 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 26 Sep 2018 12:47:29 +0000 (26 15:47 +0300)
tree651f12e3c6d9ad50676a119b89a8d0dab8a2599a
parent6c35ea0377744404ec7d6b031a907169a304e13b
function_hooks: hack around fallout from moving the assignment to the end

I moved the fake assignment to the end so that we would have already parsed
the PARAM_LIMIT before we do the assignment.  But then we run into stuff
like this:

int frob(struct whatever *p)
{
int ret = p->a;

kfree(p);
return a;
}

So now we parse PARAM_FREE p and then fake an assignment "x = p->a;".  So
now we get errors that we're dereferencing "p" when it's freed.  My
solution is just to not generate those warnings when we're in a fake
assignment.  But then smatch_comparison starts ignoring those assignments
as well so we have to make it not ignore certain fake assignments...

It's a bit hacky, but I think it should work.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_free.c
check_free_strict.c
smatch_comparison.c
smatch_function_hooks.c