aboutsummaryrefslogtreecommitdiff
path: root/Documentation/filesystems/caching/backend-api.rst
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2023-09-12 19:22:24 +0300
committerKees Cook <keescook@chromium.org>2023-09-13 20:09:49 -0700
commit32a4ec211d4164e667d9d0b807fadf02053cd2e9 (patch)
tree910f19d0b1423e9898ae09b71a3d4e4686685413 /Documentation/filesystems/caching/backend-api.rst
parent531108ec5b5cd45ec6272a6115e73275baef7d22 (diff)
uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++
__DECLARE_FLEX_ARRAY(T, member) macro expands to struct { struct {} __empty_member; T member[]; }; which is subtly wrong in C++ because sizeof(struct{}) is 1 not 0, changing UAPI structures layouts. This can be fixed by expanding to T member[]; Now g++ doesn't like "T member[]" either, throwing errors on the following code: struct S { union { T1 member1[]; T2 member2[]; }; }; or struct S { T member[]; }; Use "T member[0];" which seems to work and does the right thing wrt structure layout. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Fixes: 3080ea5553cc ("stddef: Introduce DECLARE_FLEX_ARRAY() helper") Link: https://lore.kernel.org/r/97242381-f1ec-4a4a-9472-1a464f575657@p183 Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'Documentation/filesystems/caching/backend-api.rst')
0 files changed, 0 insertions, 0 deletions