[RFC PATCH 0/1] compiler_types.h: introduce ASSUME_NONNULL macro for static analysis
Raka Gunarto
rakagunarto at gmail.com
Fri Jul 25 08:42:14 EDT 2025
On Fri, Jul 25, 2025 at 1:19 PM Mulyadi Santosa
<mulyadi.santosa at gmail.com> wrote:
> Interesting idea. Other than silencing clang analyzer warning, what is exactly the advantage of using such macro?
Well there are three main advantages that I saw:
- Clarity to readers that the pointer is guaranteed to be non-null,
and that a check is redundant (because performance critical context,
etc.)
- Future patches that decide to use this macro can be a signal to
reviewers to actually check correctness that a pointer is indeed
invariably non-null
- Make static analysis more useful by documenting when a certain false
positive is actually false
I also wondered if it could reduce the possibility and volume of AI
generated patches from just running analyzers on the kernel to reduce
noise.
I was also planning to create a heuristic tool to check a patch if a
code change could affect a path using this macro and break the
assertion.
Raka
More information about the Kernelnewbies
mailing list