aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-09-22 16:46:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-09-22 16:46:55 -0700
commitd90b0276af8f25a0b8ae081a30d1b2a61263393b (patch)
treec46ab3135283da10cdf632e41c92eef4b0b705a5
parent3abc79dce60e91f2aeec8abf1d09b250722fbeb5 (diff)
parent32a4ec211d4164e667d9d0b807fadf02053cd2e9 (diff)
downloadlinux-loongson-d90b0276af8f25a0b8ae081a30d1b2a61263393b.tar.gz
Merge tag 'hardening-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening fixes from Kees Cook: - Fix UAPI stddef.h to avoid C++-ism (Alexey Dobriyan) - Fix harmless UAPI stddef.h header guard endif (Alexey Dobriyan) * tag 'hardening-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++ uapi: stddef.h: Fix header guard location
-rw-r--r--include/uapi/linux/stddef.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
index 7c3fc398088110..5c6c4269f7efe4 100644
--- a/include/uapi/linux/stddef.h
+++ b/include/uapi/linux/stddef.h
@@ -29,6 +29,11 @@
struct TAG { MEMBERS } ATTRS NAME; \
}
+#ifdef __cplusplus
+/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
+#define __DECLARE_FLEX_ARRAY(T, member) \
+ T member[0]
+#else
/**
* __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
*
@@ -49,3 +54,5 @@
#ifndef __counted_by
#define __counted_by(m)
#endif
+
+#endif /* _UAPI_LINUX_STDDEF_H */