Skip to contentSkip to conversation

Static code analysis tool for openbmc

DISCUSSION Ratan Gupta 4 participants 4 messages Mar 13, 2019 – Mar 14, 2019

lore
Share & tools
lore
#0 lore raw

Hi Team,

Is there any plan to use any static code analysis tool in openbmc? I find one of the tool which is good and used in multiple opensource projects is "coverity".

Regards
Ratan Gupta

#1 lore raw
Quoted 1 line · Ratan Gupta

Is there any plan to use any static code analysis tool in openbmc? I

In Jenkins job, we have cppcheck to do checks on the code.

Quoted 2 lines

find one of the tool which is good and used in multiple opensource projects is "coverity".

I would prefer clang static analyzer, but other tools like coverity is also welcome.
And if possible, there is much stronger analyzer PVS-Studio Analyzer (need license though). I read [PVS-Studio's blog][1] and that tool is really really good.

But I think the main question is, what to do with issues found by the static analyzer? We need to define some rule to fix or ignore the issues.

[1]: https://www.viva64.com/en/b/

#2 lore raw
Quoted 8 lines · Lei YU
Quoted 1 line · Ratan Gupta

Is there any plan to use any static code analysis tool in openbmc? I

In Jenkins job, we have cppcheck to do checks on the code.

Quoted 2 lines

find one of the tool which is good and used in multiple opensource projects is "coverity".

Quoted 8 lines

I would prefer clang static analyzer, but other tools like coverity is also welcome.
And if possible, there is much stronger analyzer PVS-Studio Analyzer (need license though). I read [PVS-Studio's blog][1] and that tool is really really good.

But I think the main question is, what to do with issues found by the static analyzer? We need to define some rule to fix or ignore the issues.

In my experience with host firmware on OpenPOWER, each tool gets a different set of things that it catches. Even the humble sparse catches things that other tools do not (notably endian screw-ups).

A big advantage of Coverity is the tooling around it, the web site where you can mark things permanently as a false positive, assign things to people, etc. For other tools that you just run in a jenkins job, it's way too easy to not see things grow, or just have a large list of false positives you get used to ignoring.

Signature · 2 lines
Stewart Smith
OPAL Architect, IBM.
#3 lore raw
In reply to Ratan Gupta
Quoted 5 lines

Is there any plan to use any static code analysis tool in openbmc? I find one of the tool which is good and used in multiple opensource projects is "coverity".

I'm in full support of getting coverity started. I had some troubles with performance (the analysis for a single app takes a very long time) and unexpected false positives when I attempted it a while back, and gave up at the time. One person also did get the Facebook static analyzer, infer, running recently on an OpenBMC project and it seemed to give some results, about 10% of which were actionable, and generated some commits to OpenBMC. I'm not sure I'd advocate for it, but it's certainly another option.

-Ed