Re: [RFC PATCH 0/1] compiler_types.h: introduce ASSUME_NONNULL macro for static analysis

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---- Fri, 25 Jul 2025 18:12:14 +0530 को rakagunarto@xxxxxxxxx ने लिखा ----
> - Clarity to readers that the pointer is guaranteed to be non-null,

Assumption isn't a guarantee.

> and that a check is redundant (because performance critical context,
> etc.)

Compiler optimises it away usually.

> - 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

That can pretty easily change in future.

> - Make static analysis more useful by documenting when a certain false
> positive is actually false

Is your case really a false positive?

There is an explicit check for NULL in some other using the
get_node function, most visibly in the macro below.

If we know NULL won't be there, we should add an
assert in code instead of a silent assumption.

Thanks,
Siddh

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux