buf_comparison: add support for struct_size() array
commit7c2c6955c26b004bea89f3c13af76b579f933875
authorDan Carpenter <error27@gmail.com>
Wed, 8 Feb 2023 11:55:23 +0000 (8 14:55 +0300)
committerDan Carpenter <error27@gmail.com>
Wed, 8 Feb 2023 11:55:23 +0000 (8 14:55 +0300)
tree4e85ada7d7f626052975336436fd407d8546ac84
parent009cb0ccdcc009e6123d8b795cdc055cdf0652b1
buf_comparison: add support for struct_size() array

This code is supposed to parse stuff like:

buf = malloc(size * elem_size);

Where the size is not fixed so then if we have:

buf[x] = foo;

So long as x < size it's fine.  The problem is that sometimes we allocate
a struct with a variable length array:

my_struct = kmalloc(struct_size(type, array, count), GFP_KERNEL);

So then we need to record that "my_struct.array" as having count elements.

Signed-off-by: Dan Carpenter <error27@gmail.com>
smatch_buf_comparison.c