Skip to contentSkip to conversation

Static code analyzer annotations in driver code?

DISCUSSION Thomas Hellstrom 2 participants 3 messages Jan 4, 2017 – Jan 5, 2017

lore
Share & tools
lore
#0 lore raw

Hi!

What is the general opinion about out-of-tree static analyzer annotations in drm driver code, for example comments like

/* coverity[missing_lock] */

which typically squelches false positives in constructors or destructors of refcounted structs that contain members that are elsewhere protected by locks.

Thanks,

Thomas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 8 lines · Thomas Hellstrom

What is the general opinion about out-of-tree static analyzer annotations in drm driver code, for example comments like

/* coverity[missing_lock] */

which typically squelches false positives in constructors or destructors of refcounted structs that contain members that are elsewhere protected by locks.

It's not about out-of-tree, it's about proprietary. We already have annotations for sparse, though they're extra attributes rather than comments. Anyone can run sparse, or other open source tools. Not so with properietary tools. When you don't have the crowds maintaining the annotations, they will bitrot, becoming just stale comments in source.

I know the intention is good, but I'm not convinced.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Hi,

Quoted 9 lines · Jani Nikula
Quoted 8 lines · Thomas Hellstrom

What is the general opinion about out-of-tree static analyzer annotations in drm driver code, for example comments like

/* coverity[missing_lock] */

which typically squelches false positives in constructors or destructors of refcounted structs that contain members that are elsewhere protected by locks.

Quoted 7 lines

It's not about out-of-tree, it's about proprietary. We already have annotations for sparse, though they're extra attributes rather than comments. Anyone can run sparse, or other open source tools. Not so with properietary tools. When you don't have the crowds maintaining the annotations, they will bitrot, becoming just stale comments in source.

I know the intention is good, but I'm not convinced.

Thanks for your comments. In the coverity special case, though, Linux is added to the
Coverity OSS effort:

https://scan.coverity.com/projects/linux

which makes it possible for anyone to use the tool to pinpoint defects.

Now admittedly there might be a number of tools, some open source, some not, that may find false
positives in the exact same code statement and annotate for one tool will still make the other ones
complain but at least then the issue can quickly be flagged as a false positive..

/Thomas

Quoted 5 lines

BR,
Jani.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel