Performing pointer arithmetic on a null pointer?
    Hyeonggon Yoo 
    42.hyeyoo at gmail.com
       
    Thu May 27 11:14:43 EDT 2021
    
    
  
Hello, I was compiling kernel with make CC=clang-10 W=1 -s
there are some places that compiler complains about
pointer arithmetic like below.it says it's undefined behavior.
is it just OK to use UBs like this (I hope it's not),
or am I missing something?
fs/kernfs/file.c:128:15: warning: performing pointer arithmetic on
	a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
                return NULL + !*ppos;
    
    
More information about the Kernelnewbies
mailing list