Re: [PATCH] Input: xpad - fix GPF in xpad_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Btw, we should be thinking about how to detect these sorts of issues
using static analysis.  Unfortunately, it's not as simple as saying
"We know this variable is NULL so don't dereference it."  The problem
with that is that many times Smatch sees where a pointer is set to NULL
but not when it is assigned to a different value.

What we could do instead is say:
1) If a pointer is dereferenced and we know it is NULL then:
    set_state_expr(my_id, expr, &suspicious);
2) If we set a pointer to non-NULL and it is marked as suspicious then
   print a warning.

This would generate a warning for cases where we dereference a pointer
before it has been initialized.

It is not hard to write a Smatch check like this.  The first draft
approach is only three functions long.

regards,
dan carpenter




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux