comparison: introduce possible_comparison()
commit8bb1902d60515814ada16f83c8fa6153537887de
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 29 Aug 2014 10:41:38 +0000 (29 13:41 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 29 Aug 2014 10:41:38 +0000 (29 13:41 +0300)
tree5dbd1a0612ea72448e5f6558b2384df49471a564
parent0c3fe79274618f1f5f8417908a90ef4811438a21
comparison: introduce possible_comparison()

You call this function like this:

if (possible_comparison(a, SPECIAL_EQUAL, b)) {

It returns true if we think that a is possibly equal to be.  I will use
this to check for off-by-one bugs like this:

buf = kmalloc(len, GFP_KERNEL);
...
buf[len] = '\0';

If we store the relationship that "the size of buf is len" then later we
can see that the index is possibly equal so it's off by one.

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