Commit
2084c24 ("do not export kernel's NULL #define to userspace") broken KVM
tool build:
FYI:
CC framebuffer.o
In file included from include/kvm/framebuffer.h:5:0,
from framebuffer.c:1:
../../include/linux/list.h: In function ‘INIT_HLIST_NODE’:
../../include/linux/list.h:572:12: error: ‘NULL’ undeclared (first use in this function)
../../include/linux/list.h:572:12: note: each undeclared identifier is reported only once for each function it appears in
../../include/linux/list.h: In function ‘hlist_move_list’:
../../include/linux/list.h:657:15: error: ‘NULL’ undeclared (first use in this function)
make: *** [framebuffer.o] Error 1
due to this upstream commit:
2084c24a8141 do not export kernel's NULL #define to userspace
Fix that.
Reported-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
--- /dev/null
+#ifndef _LINUX_STDDEF_H
+#define _LINUX_STDDEF_H
+
+#include <linux/compiler.h>
+
+#undef NULL
+#define NULL ((void *)0)
+
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
+#endif