CI: Add smatch static analysis workflow #17935
Open
+49
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
As discussed in #17885 we want to enforce certain cstyle guidelines and catch bugs early in the development process. Adding the smatch code checker to the CI can help with both of these things. This PR automates running the analysis but it will take a concerted effort to resolve all the warnings.
Description
Smatch is an actively maintained kernel-aware static analyzer for C with a low false positive rate. Since the code checker can be run relatively quickly against the entire OpenZFS code base (15 min) it makes sense to add it as a GitHub Actions workflow. Today smatch reports a significant numbers warnings so the workflow is configured to always pass as long as the analysis was run. The results are available for reference. Long term it would ideal to resolve all of the errors/warnings at which point the workflow can be updated to fail when new problems are detected.
How Has This Been Tested?
Lightly tested here, https://github.com/behlendorf/zfs/actions/runs/19380431337
Types of changes
Checklist:
Signed-off-by.