Skip to content

Commit 2084c24

Browse files
Lubos Lunaktorvalds
authored andcommitted
do not export kernel's NULL #define to userspace
GCC's NULL is actually __null, which allows detecting some questionable NULL usage and warn about it. Moreover each platform/compiler should have its own stddef.h anyway (which is different from linux/stddef.h). So there's no good reason to leak kernel's NULL to userspace and override what the compiler provides. Signed-off-by: Luboš Luňák <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 668ce0a commit 2084c24

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

include/linux/stddef.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33

44
#include <linux/compiler.h>
55

6+
#ifdef __KERNEL__
7+
68
#undef NULL
7-
#if defined(__cplusplus)
8-
#define NULL 0
9-
#else
109
#define NULL ((void *)0)
11-
#endif
12-
13-
#ifdef __KERNEL__
1410

1511
enum {
1612
false = 0,

0 commit comments

Comments
 (0)