linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
Cc: Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: arm64: kernel/sys.c - silence initialization warnings.
Date: Mon, 15 Mar 2021 11:14:34 +0000	[thread overview]
Message-ID: <20210315111433.GA22897@arm.com> (raw)
In-Reply-To: <162859.1615542946@turing-police>

On Fri, Mar 12, 2021 at 04:55:46AM -0500, Valdis Klētnieks wrote:
> Building arch/arm64/kernel/sys.o with W=1 throws over 300 warnings:
> 
> /usr/src/linux-next/arch/arm64/kernel/sys.c:56:40: warning: initialized field overwritten [-Woverride-init]
>    56 | #define __SYSCALL(nr, sym)      [nr] = __arm64_##sym,
>       |                                        ^~~~~~~~
> /usr/src/linux-next/include/uapi/asm-generic/unistd.h:29:37: note: in expansion of macro '__SYSCALL'
>    29 | #define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
>       |                                     ^~~~~~~~~
> /usr/src/linux-next/include/uapi/asm-generic/unistd.h:34:1: note: in expansion of macro '__SC_COMP'
>    34 | __SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
>       | ^~~~~~~~~
> 
> We know that's pretty much the file's purpose in life, so tell the
> build system to not remind us.  This makes the 1 other warning a
> lot more noticeable. 
> 
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> 
> diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
> index ed65576ce710..916b21d2b35b 100644
> --- a/arch/arm64/kernel/Makefile
> +++ b/arch/arm64/kernel/Makefile
> @@ -8,6 +8,7 @@ CFLAGS_armv8_deprecated.o := -I$(src)
>  CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_insn.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE)
> +CFLAGS_sys.o += $(call cc-disable-warning, override-init)

We do similar initialisation in arch/arm64/kernel/sys32.c and
arch/arm64/kernel/traps.c for example. It's a pretty common pattern
throughout the kernel.

So we either treat W=1 output as diff against the vanilla kernel when
checking new patches or we remove override-init altogether from W=1.
Mark Rutland pointed me to an older thread:

https://lore.kernel.org/linux-arm-kernel/20190809083251.GA48423@lakrids.cambridge.arm.com/

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-03-15 11:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  9:55 arm64: kernel/sys.c - silence initialization warnings Valdis Klētnieks
2021-03-15 11:14 ` Catalin Marinas [this message]
2021-03-15 19:23   ` Christoph Hellwig
2021-03-16  0:30     ` Valdis Klētnieks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315111433.GA22897@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=valdis.kletnieks@vt.edu \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).