Re:Simple Linux kernel memory corruption bug can lead to com...
by IshKebab on Wednesday October 20, 2021 @08:48AM
(#28930007)
Yeah sounds like the best solution is explicit checks that the compiler understands - REDUNDANT_NULL_CHECK(...), REQUIRED_NULL_CHECK(...).
I mean obviously the solution is to use a sane language but you know...
This can be the case now, but then later someone adds new code that you did need that null check.
> If you think you do need them then it's a sign you've screwed up somewhere and should fix it!
Hm, so instead of
> Wouldn't it be better to have compile errors if the compiler figures out that it can remove a null check?
you wanted the opposite: warn when a null check is there and was actually required :).
Not sure if this is a working solution either. Maybe if it was behind a macro, JUST_CHECKING_IF_NULL(x)..