sval: introduce "hard max"
commitbaf01ad17488fd3aa4a2198abe763ac0cf69e6a3
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 12 Nov 2012 12:54:10 +0000 (12 15:54 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Mon, 12 Nov 2012 12:54:10 +0000 (12 15:54 +0300)
tree59b3b75192f51844ef82c22fa958b329ba2ca8d1
parent195246bd0551741f5c497e314e23a155719dd0e7
sval: introduce "hard max"

The problem is that say we have:

unsigned char a;
int b;
...
if (!a)
return;
b = a;

At the end it is implied that b is 1-255.  But then if use b as an offset
into an array we get all kinds of false positive warnings if the array has
fewer than 256 elements.

The way to fix this is to record whether the maximum value is a hard max
or soft max.  The array overflow checks actually care about fuzzy max, and
I have changed fuzzy max to check for a hard max first before checking
for a fuzzy max.

Really, I think the smatch_absolute work was supposed to fix this problem
and it didn't.  I should just remove it.  I will try do that in a later
patch.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_debug.c
check_debug.h
smatch.h
smatch_estate.c
smatch_extra.c
smatch_extra.h
smatch_math.c