param_clear: add support for BUF_ADD
commit55aae9c3de7a19e1aa1ad072889429040b70aba9
authorDan Carpenter <error27@gmail.com>
Thu, 9 Mar 2023 13:38:21 +0000 (9 16:38 +0300)
committerDan Carpenter <error27@gmail.com>
Thu, 9 Mar 2023 13:38:21 +0000 (9 16:38 +0300)
tree1437c20c6a256e2c76c92bd6cc14b932d0aac6e3
parentd9ba2e1a75f7addc184949801b561b026dd26613
param_clear: add support for BUF_ADD

This is a sort similar situation to PARAM_ADD.  PARAM_ADD means you take
a function parameter "*x" and you leave some or all of the original values
but you also assign it a value.

void frob(int *x)
{
if (something)
*x = 100;
}

The value *x after the call is all the original possible values, but also
potentially 100.

This is the same except with buffers.  You have a memcpy() which happens
on one path but not on the other paths.  Originally there was a possibility
that this would get translated into over a thousand useless PARAM_ADD
values.  I want it instead to be saved as a single (probably still useless)
BUF_ADD entry.

It's hard to know what to do with this information in the caller.  I guess
the only thing to do is ensure that everything is marked as unknown in
smatch_extra.c.

Signed-off-by: Dan Carpenter <error27@gmail.com>
smatch.h
smatch_data/db/smdb.py
smatch_extra.c
smatch_param_cleared.c