Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several mistakes discovered by clang scan-build #7407

Merged
merged 4 commits into from Jan 2, 2023

Conversation

jepler
Copy link
Member

@jepler jepler commented Jan 1, 2023

I used scan-build make CC=analyze-cc with clang-11 on the unix coverage build. It uncovered several interesting things (but also a bunch of irrelevant things as well as some things that appeared to be false positives). No testing performed.

(1 << 32), an operation on a signed 32-bit int, is undefined in C. The
operation on the unsigned int (1u<<32) is defined as zero, which is
the desired outcome (subtracting 1 yields the value with all bits set)

This problem was detected by clang scan-build static analysis
error detected by clang scan-build static analysis
clang scan-build reports "Access to field 'table' results in a
dereference of a null pointer (loaded from variable 'kw_args')"
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all make sense to me -- thanks!

@dhalbert dhalbert merged commit 8f951bd into adafruit:main Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants