summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-17 15:34:25 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-22 12:46:05 +0100
commit9d02708e4bad64e247d5957144f631cf06ef8720 (patch)
treec5131cae61df5a71746fa1e0002b3662e50589f2 /arch
parent808f1e4b5723ae4eda724d2ad6f6638905eefd95 (diff)
downloadlinux-stable-9d02708e4bad64e247d5957144f631cf06ef8720.tar.gz
linux-stable-9d02708e4bad64e247d5957144f631cf06ef8720.tar.bz2
linux-stable-9d02708e4bad64e247d5957144f631cf06ef8720.zip
Revert "x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN"
This reverts commit 67c6d79777cf5d3165d6d2e2d7c5e37333d1a76e which is commit 55228db2697c09abddcb9487c3d9fa5854a932cd upstream. _Alignof is not in the gcc version that the 4.14.y kernel still supports (3.2), so this change needs to be reverted as it breaks the build on those older compiler versions. Reported-by: Michael Nies <michael.nies@netclusive.com> Link: https://lore.kernel.org/r/HE1PR0902MB188277E37DED663AE440510BE1D99@HE1PR0902MB1882.eurprd09.prod.outlook.com Link: https://bugzilla.kernel.org/show_bug.cgi?id=217013 Cc: YingChi Long <me@inclyc.cn> Cc: Borislav Petkov <bp@suse.de> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/fpu/init.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c
index a3a570df6be1..9692ccc583bb 100644
--- a/arch/x86/kernel/fpu/init.c
+++ b/arch/x86/kernel/fpu/init.c
@@ -138,6 +138,9 @@ static void __init fpu__init_system_generic(void)
unsigned int fpu_kernel_xstate_size;
EXPORT_SYMBOL_GPL(fpu_kernel_xstate_size);
+/* Get alignment of the TYPE. */
+#define TYPE_ALIGN(TYPE) offsetof(struct { char x; TYPE test; }, test)
+
/*
* Enforce that 'MEMBER' is the last field of 'TYPE'.
*
@@ -145,8 +148,8 @@ EXPORT_SYMBOL_GPL(fpu_kernel_xstate_size);
* because that's how C aligns structs.
*/
#define CHECK_MEMBER_AT_END_OF(TYPE, MEMBER) \
- BUILD_BUG_ON(sizeof(TYPE) != \
- ALIGN(offsetofend(TYPE, MEMBER), _Alignof(TYPE)))
+ BUILD_BUG_ON(sizeof(TYPE) != ALIGN(offsetofend(TYPE, MEMBER), \
+ TYPE_ALIGN(TYPE)))
/*
* We append the 'struct fpu' to the task_struct: