[PATCH 3/5] nios2: uapi: Stop leaking CONFIG_NIOS2_CI_SWAB_{NO,SUPPORT} references to userspace
Arnd Bergmann
arnd at arndb.de
Tue Dec 30 13:19:22 PST 2025
On Tue, Dec 30, 2025, at 08:10, Thomas Weißschuh wrote:
> UAPI headers are not supposed to leak references to kconfig symbols.
> These won't be set when building userspace. Hide the kconfig reference
> behind 'ifdef __KERNEL__', so it will be stripped by
> headers_install.sh. The result for userspace will be the same, but the
> exceptions in headers_install.sh can also be removed.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
Acked-by: Arnd Bergmann <arnd at arndb.de>
> ---
> arch/nios2/include/uapi/asm/swab.h | 2 ++
> scripts/headers_install.sh | 2 --
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/nios2/include/uapi/asm/swab.h
> b/arch/nios2/include/uapi/asm/swab.h
> index 9750547a5f82..bbfa9bd10b2f 100644
> --- a/arch/nios2/include/uapi/asm/swab.h
> +++ b/arch/nios2/include/uapi/asm/swab.h
> @@ -14,6 +14,7 @@
> #include <linux/types.h>
> #include <asm-generic/swab.h>
>
> +#ifdef __KERNEL__
> #ifdef CONFIG_NIOS2_CI_SWAB_SUPPORT
> #ifdef __GNUC__
>
I'm fairly sure this approach is correct, but I noticed
that this makes arch/nios2/include/uapi/asm/swab.h empty
in userspace, so you could just move the current file
to arch/nios2/include/asm/swab.h instead and fall back to
the asm-generic header for uapi.
Arnd
More information about the linux-snps-arc
mailing list