mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] um: include sys/types.h instead of stddef.h for size_t
@ 2022-07-13 10:00 Jason A. Donenfeld
  2022-07-17  8:53 ` [PATCH v2] um: include sys/types.h " Jason A. Donenfeld
  0 siblings, 1 reply; 2+ messages in thread
From: Jason A. Donenfeld @ 2022-07-13 10:00 UTC (permalink / raw)
  To: Johannes Berg, linux-um, linux-kernel; +Cc: Jason A. Donenfeld

Usually size_t comes from sys/types.h, not stddef.h. This code likely
worked only because something else in its usage chain was pulling in
sys/types.h.

Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/um/include/shared/user.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
index dd4badffdeb3..a0a8f0d19a85 100644
--- a/arch/um/include/shared/user.h
+++ b/arch/um/include/shared/user.h
@@ -13,21 +13,21 @@
  * fancier, type-safe, definition.  Using that one would require
  * copying too much infrastructure for my taste, so userspace files
  * get less checking than kernel files.
  */
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* This is to get size_t */
 #ifndef __UM_HOST__
 #include <linux/types.h>
 #else
-#include <stddef.h>
+#include <sys/types.h>
 #endif
 
 extern void panic(const char *fmt, ...)
 	__attribute__ ((format (printf, 1, 2)));
 
 /* Requires preincluding include/linux/kern_levels.h */
 #define UM_KERN_EMERG	KERN_EMERG
 #define UM_KERN_ALERT	KERN_ALERT
 #define UM_KERN_CRIT	KERN_CRIT
 #define UM_KERN_ERR	KERN_ERR
-- 
2.35.1


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

* [PATCH v2] um: include sys/types.h for size_t
  2022-07-13 10:00 [PATCH] um: include sys/types.h instead of stddef.h for size_t Jason A. Donenfeld
@ 2022-07-17  8:53 ` Jason A. Donenfeld
  0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2022-07-17  8:53 UTC (permalink / raw)
  To: linux-um, linux-kernel; +Cc: Jason A. Donenfeld, Johannes Berg

Usually size_t comes from sys/types.h, not stddef.h. This code likely
worked only because something else in its usage chain was pulling in
sys/types.h. stddef.h is still required for NULL, however, so note this.

Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 arch/um/include/shared/user.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
index dd4badffdeb3..bda66e5a9d4e 100644
--- a/arch/um/include/shared/user.h
+++ b/arch/um/include/shared/user.h
@@ -16,11 +16,12 @@
  */
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
-/* This is to get size_t */
+/* This is to get size_t and NULL */
 #ifndef __UM_HOST__
 #include <linux/types.h>
 #else
 #include <stddef.h>
+#include <sys/types.h>
 #endif
 
 extern void panic(const char *fmt, ...)
-- 
2.35.1


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

end of thread, other threads:[~2022-07-17  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 10:00 [PATCH] um: include sys/types.h instead of stddef.h for size_t Jason A. Donenfeld
2022-07-17  8:53 ` [PATCH v2] um: include sys/types.h " Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®