extra: use PARAM_LIMIT to limit binops
commit49535b04a37ca66a39f87dea9e0a8e04629b5461
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 22 Jun 2018 11:30:42 +0000 (22 14:30 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 22 Jun 2018 11:30:42 +0000 (22 14:30 +0300)
tree11c380a3b13f1c3355efeedff520238c9af9957e
parenta71ed273c4b31073443c33ef7ac258a3c9eeb537
extra: use PARAM_LIMIT to limit binops

I was trying to use this code to handle kmalloc(x * sizeof(), GFP_KERNEL);

We know if the kmalloc() fails, then the size is capped, but in this case
the size is a binop so we're not setting anything.  But we'd want to cap
x...  Hence this patch.  It occurs to me now as I write this commit message
that we could do this better inside set_extra_nomod().

Also this code doesn't work great because can_integer_overflow() is too
cautious.  It turns out implementing can_integer_overflow() is quite
tricky...

Anyway, I've been running this for a while and I want to make my diff with
the released code smaller.

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