[ovs-dev] [PATCH 00/11] Fix clang static analysis null pointer bugs.

Ben Pfaff blp at ovn.org
Mon Oct 30 19:20:33 UTC 2017


On Sat, Oct 28, 2017 at 10:31:47AM -0700, William Tu wrote:
> Before the patch, the scan-build reports 46 bugs found.
> The patch series fix the clang static checker bug group:
> "Argument with nonnull attribute passed null"
> Most of the fixes are adding "ovs_assert" to tell the checker
> that the pointer won't be null. Now the bugs count reduces to 35.
> Tested it by doing "make clang-analyze"

Thanks for taking a look at all those warnings.

In general, I'm not a fan of adding assertions for nonnull pointers that
are dereferenced soon after.  This kind of an assertion doesn't really
help much, because it just converts a SIGSEGV signal into a SIGABRT
signal.  I agree that it makes sense to add them when the assertion is
long before the dereference, or if the pointer should always be nonnull
but is not necessarily dereferenced.

I don't think it should be a goal to eliminate all clang-analyzer
warnings.  clang-analyzer simply doesn't have enough context in many
cases, so it gives incorrect warnings.

I'll make some more specific comments on individual patches.


More information about the dev mailing list