All of lore.kernel.org
 help / color / mirror / Atom feed
* Performing pointer arithmetic on a null pointer?
@ 2021-05-27 15:14 Hyeonggon Yoo
  2021-05-27 15:27 ` Lukas Bulwahn
  2021-05-27 15:32 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Hyeonggon Yoo @ 2021-05-27 15:14 UTC (permalink / raw)
  To: kernelnewbies

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;

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-27 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 15:14 Performing pointer arithmetic on a null pointer? Hyeonggon Yoo
2021-05-27 15:27 ` Lukas Bulwahn
2021-05-27 15:56   ` Hyeonggon Yoo
2021-05-27 15:32 ` Greg KH
2021-05-27 15:49   ` Hyeonggon Yoo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.