Use static analysis tools to check null pointers and memory leaks in Linux device drivers

1k views Asked by At

I want to use static analysis tools to detect null-pointer dereferences and memory leaks in Linux device drivers (linux-3.17.2).

I have tried some tools:

  1. Clang static analyzer
    It shows some unimportant warnings, such as "Value stored to 'usbhid' during its initialization is never read".
  2. Smatch and Cppcheck They find some defects, but many null-pointer dereferences found by maintainers or myself can not be detected.

Could you recommend some other useful static tools to detect real bugs in Linux device drivers?

2

There are 2 answers

0
Eugene Rourke On

Not so long ago there was published an article about Linux 3.18.1 check by PVS-Studio. Searching memory leaks is their darling hobby; they greatly cope with searching misprints. Nevertheless, they found bugs, and I decided to mention this article here. By the way, they have many articles about their searches - where and what they found.

1
Lonzak On

Here is a list of available tools. Depending whether you look for "free" tools or commercial - it gives you a good overview. One additional possibility is the coverity scan project - where open source projects can apply and get a free scan from coverity.

Other opions are: