index_overflow: almost a re-write
commitcc97541e0a46c459e6d685a6a42141c3f1b3814b
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 Mar 2018 12:08:39 +0000 (29 15:08 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 Mar 2018 12:08:39 +0000 (29 15:08 +0300)
tree10ec7bf7414ef45850460cfc96aa8d5a46dad38d
parent3b5bf5c91fe648f89c12dfeb4cda3fe36e7f19c5
index_overflow: almost a re-write

The index_overflow code is really important but also pretty bad.

This implements several changes.  First I wanted to print more information
about why a warning was printed.  So now the error messages says if we're
printing it because we think the index is untrusted user data.  Or if it's
because the code assumes that a for loop hit a break statement instead of
ending because we hit the limit.  I also silence some warnings or mark
them as low quality if there is a subtraction involved (Smatch is bad at
parsing subtractions).

The other thing is that we can silence a bunch of warnings if they only
happen on an impossible path.  This code is a bit tricky.  If we were going
to print a warning, then let's assume() that the index is out of bounds and
see if that implies some other condition is impossible.

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