param_limit: handle struct members
commit2c9b820309f1fad6a4ef64b569e032e82b749b68
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 30 Mar 2015 11:34:04 +0000 (30 14:34 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 30 Mar 2015 11:34:04 +0000 (30 14:34 +0300)
tree35109d265e0bc9a22efa63f117e511a82df73492
parent18e5ac601d9f21675fb7ef47c0c3faac083a4890
param_limit: handle struct members

PARAM_LIMIT is code like this:

int is_ok(struct foo *p)
{
if (p->bar >= 0 && p->bar < 100)
return 1;
return 0;
}

PARAM_FILTER looks like this:

void some_func(struct foo *p)
{
if (p->bar < 0 || p->bar >= 100)
p->bar = 0;
}

In the original code, if it was a parameter "$" then we limited it, but
if it was a struct member "$->bar" then we filtered it.  This was wrong
and it caused some false positives.  Also a struct member can be both
limited and filtered so the ordering has to be handle the limits first and
then the filtering.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch.h
smatch_param_filter.c
smatch_param_limit.c