qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] QEMU versus Facebook's Infer static analysis tool
@ 2015-11-14 21:53 Peter Maydell
  2015-11-16  9:41 ` Paolo Bonzini
  2015-11-25  7:40 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2015-11-14 21:53 UTC (permalink / raw)
  To: QEMU Developers

So I tried out Facebook's Infer static analysis tool (http://fbinfer.com/)
on QEMU this evening, just to see whether it would be able to handle our
codebase and if it would report anything interesting.

The good news is it was easy enough to install and didn't fall over;
all you have to do to run it is (a) configure; (b) run "infer -- make -j4"
in the build directory.

The bad news is that it really doesn't get on with our QOM cast macros.
It produces over a thousand false positives for code like
    CadenceUARTState *s = CADENCE_UART(dev);
    s->r[R_CR] = 0x00000128;
where as far as I can tell it thinks that 's' could be NULL when
deferenced because:
 * the QOM cast macro has an internal call to object_dynamic_cast_assert()
 * object_dynamic_cast_assert() handles being passed NULL (it returns NULL
   if the input is NULL), so it includes tests for 'obj != NULL'
 * infer assumes that this test implies that obj could be NULL in this
   code path

That's a shame, because it would have been nice to include another
kind of static analysis in what we run on QEMU (especially since
the coverity tests are "only runs every so often when we do a build"),
and the ability to do incremental analysis would have meant you could
include it in day to day workflow much more easily.

In summary: worth keeping an eye on to see if it improves, but for
now I figured I'd just post this email to the list to save anybody
else running through the same process to come to the same conclusion.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-25  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-14 21:53 [Qemu-devel] QEMU versus Facebook's Infer static analysis tool Peter Maydell
2015-11-16  9:41 ` Paolo Bonzini
2015-11-25  7:40 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).