> On Nov 25, 2020, at 20:17, Borislav Petkov <bp@xxxxxxxxx> wrote: > > On Thu, Nov 19, 2020 at 11:02:34AM -0800, Chang S. Bae wrote: >> diff --git a/arch/x86/include/asm/sigframe.h b/arch/x86/include/asm/sigframe.h >> index 84eab2724875..ac77f3f90bc9 100644 >> --- a/arch/x86/include/asm/sigframe.h >> +++ b/arch/x86/include/asm/sigframe.h >> @@ -52,6 +52,15 @@ struct rt_sigframe_ia32 { >> char retcode[8]; >> /* fp state follows here */ >> }; >> + >> +#define SIZEOF_sigframe_ia32 sizeof(struct sigframe_ia32) >> +#define SIZEOF_rt_sigframe_ia32 sizeof(struct rt_sigframe_ia32) >> + >> +#else >> + >> +#define SIZEOF_sigframe_ia32 0 >> +#define SIZEOF_rt_sigframe_ia32 0 >> + >> #endif /* defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) */ >> >> #ifdef CONFIG_X86_64 >> @@ -81,8 +90,22 @@ struct rt_sigframe_x32 { >> /* fp state follows here */ >> }; >> >> +#define SIZEOF_rt_sigframe_x32 sizeof(struct rt_sigframe_x32) >> + >> #endif /* CONFIG_X86_X32_ABI */ >> >> +#define SIZEOF_rt_sigframe sizeof(struct rt_sigframe) >> + >> +#else >> + >> +#define SIZEOF_rt_sigframe 0 >> + >> #endif /* CONFIG_X86_64 */ >> >> +#ifndef SIZEOF_rt_sigframe_x32 >> +#define SIZEOF_rt_sigframe_x32 0 >> +#endif > > Those are defined here to be used in only one place - > init_sigframe_size() - where there already is ifdeffery. Just use the > normal sizeof() operator there instead of adding more gunk here. [ Just want to clarify your comment. ] Admittedly, this is an (ugly) workaround to avoid compile errors. E.g. when code is written like this in the function: if (IS_ENABLED(CONFIG_X86_X32_ABI)) size = max(size, sizeof(struct rt_sigframe_x32)); and compile with CONFIG_X86_X32_ABI=n, got such a message: "invalid application of 'sizeof' to incomplete type 'struct sigframe_ia32’" While the coding-style doc [1] seems to mention this: "However, this approach still allows the C compiler to see the code inside the block, and check it for correctness (syntax, types, symbol references, etc). Thus, you still have to use an #ifdef if the code inside the block references symbols that will not exist if the condition is not met.” In general, putting #ifdef in a C file is advised to avoid. I wonder whether it is okay to include #ifdef in the C file in this case. Thanks, Chang [1] https://www.kernel.org/doc/html/v5.9/process/coding-style.html