user_data: fix returned user data from a parameter
commit2398b663c08108ace9a51b5ef9136c7965962553
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 31 Aug 2021 14:08:39 +0000 (31 17:08 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Tue, 31 Aug 2021 14:08:39 +0000 (31 17:08 +0300)
tree3a49a721c21dc7f7065c8cbe1214bd98ee4bc07e
parent1ce979bcfff744184c59d1b54abc39d4df07eb2a
user_data: fix returned user data from a parameter

One of the validation tests has:

struct my_struct *returns_filter(struct my_struct *p)
{
        return p;
}

The problem is that both $->x it user data for both param 0 and the
returned value (param -1).  The way that this function was handled
changed in commit 71ff19ead91c ("db: prefer storing param data over return
data").  Originally Smatch recorded that -1 was user data but now it
records that 0 is user data.  (It doesn't actually record anything because
it was user data to begin with).

Fortunately if a function returns a parameter, that's recorded and
generates a fake assignment which will set the right stuff to user data.

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