I propose to change the fun(pointer + 0) logic with fun(pointer, 0). We still maintain the sanity checks and we can optimize the code to generate not worse code than before. We can pass the "0" argument only with DIAGNOSTIC or DEBUG kernel. http://netbsd.org/~kamil/patch-00242-pslist-avoid-null-pointer-arithmetic.txt I confirm that with this change there are no longer any reports UBSan reports. I'm open to tune this patch to expected coding style.
Attachment:
signature.asc
Description: OpenPGP digital signature