leaks: don't reset states to themselves
Take this sample code:
foo = kmalloc(); <- set state to &allocated here
if (!foo)
return -ENOMEM; <- state should be &ok here
if (!bar)
return -EINVAL; <- state should be &allocated here
So when we get to the condition "if (!foo) ", the most likely scenario is
that we start with &allocated. In the original code, we set the true side
to &allocated (which it already was) and the false side to &ok (meaning
that it's ok to return here because it won't leak).
The problem is that setting it from &allocated to &allocated meant that we
screwed up the implications so when the implication code said "Have we
changed the state since our implication the answer was yes when really it
should have been no." Then because implications weren't working correctly
it lead to false positives.
Reported-by: Amir Vadai <amir@vadai.me>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>