param_set: don't save if the parent is set
commitf02a2f5053f0f64f425eb621822c90960e356950
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 12 Sep 2018 11:20:54 +0000 (12 14:20 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 12 Sep 2018 11:20:54 +0000 (12 14:20 +0300)
tree14370ae3a82488d27830cf98b75dec96c57136ac
parentde35944933fccbe78a434b797a73473c7073522c
param_set: don't save if the parent is set

I was looking at pci_physfn() return states.  That function looks like
this:

static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
{
if (dev->is_virtfn)
dev = dev->physfn;
return dev;
}

The "dev = dev->physfn;" assignment is a struct assignment so we do about
2k fake assignments.  When we're inserting these into the DB we have a
check to see if the parent was set, but in this case we don't record that
"dev" was set into the DB because it's on the stack.  So now we store 2k
records to show that everything inside dev is changed which wastes a lot
of resources and is wrong because "dev" is stack.

Also I think it means that we save 2k states as PARAM_USED, I'm not totally
sure because there was another issue with NOSPEC where we were saving a
bunch of states where they weren't user data.  Anyway, fixed now.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_param_set.c