Saturday, November 23, 2019

SonarQube / SonarCloud for kernel module static analysis

SonarCloud (online version of SonarQube) can be used for static code analysis of C code of kernel modules. It also has a nice and simple integration with GitHub and Travis CI, although there are some known issues . I have successfully used it with my FL2000 DRM dongle driver pet project, some interesting results:

  • In order to get it working with Travis on Ubuntu 18.04 had to use "proposed" repository with 5.3 GCP kernel headers
  • Issue with incorrect interceptor library filename can be solved as I described in a comment to SonarQube issue on community forum
  • Analysis gave me some recommendations around MISRA compliance, cool!
  • Plenty of "smells" are useless, of course, but still worth to review
Now need to implement synthetic DRM tests on Travis, user mode Linux maybe, or qemu / virtme, but how to collect coverage?

No comments: