All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: kbuild-all@lists.01.org
Subject: Re: arch/arm64/kernel/fpsimd.c:1944:55: sparse: sparse: dereference of noderef expression
Date: Tue, 31 May 2022 17:57:42 +0100	[thread overview]
Message-ID: <YpZJBoxqvaCLRQfX@arm.com> (raw)
In-Reply-To: <202205280635.XKlMkfKD-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 3225 bytes --]

On Sat, May 28, 2022 at 06:49:01AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   8291eaafed36f575f23951f3ce18407f480e9ecf
> commit: e0838f6373e5cb72516fc4c26bba309097e2a80a arm64/sme: Save and restore streaming mode over EFI runtime calls
> date:   5 weeks ago
> config: arm64-randconfig-s032-20220527 (https://download.01.org/0day-ci/archive/20220528/202205280635.XKlMkfKD-lkp(a)intel.com/config)
> compiler: aarch64-linux-gcc (GCC) 11.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.4-14-g5a0004b5-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0838f6373e5cb72516fc4c26bba309097e2a80a
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout e0838f6373e5cb72516fc4c26bba309097e2a80a
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kernel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
> >> arch/arm64/kernel/fpsimd.c:1944:55: sparse: sparse: dereference of noderef expression
> 
> vim +1944 arch/arm64/kernel/fpsimd.c
> 
>   1916	
>   1917	/*
>   1918	 * __efi_fpsimd_end(): clean up FPSIMD after an EFI runtime services call
>   1919	 */
>   1920	void __efi_fpsimd_end(void)
>   1921	{
>   1922		if (!system_supports_fpsimd())
>   1923			return;
>   1924	
>   1925		if (!__this_cpu_xchg(efi_fpsimd_state_used, false)) {
>   1926			kernel_neon_end();
>   1927		} else {
>   1928			if (system_supports_sve() &&
>   1929			    likely(__this_cpu_read(efi_sve_state_used))) {
>   1930				char const *sve_state = this_cpu_ptr(efi_sve_state);
>   1931				bool ffr = true;
>   1932	
>   1933				/*
>   1934				 * Restore streaming mode; EFI calls are
>   1935				 * normal function calls so should not return in
>   1936				 * streaming mode.
>   1937				 */
>   1938				if (system_supports_sme()) {
>   1939					if (__this_cpu_read(efi_sm_state)) {
>   1940						sysreg_clear_set_s(SYS_SVCR_EL0,
>   1941								   0,
>   1942								   SYS_SVCR_EL0_SM_MASK);
>   1943						if (!system_supports_fa64())
> > 1944							ffr = efi_sm_state;

This looks wrong indeed. IIUC, something like below but waiting for Mark
to confirm:

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 819979398127..ac521b3403d6 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -1965,7 +1965,7 @@ void __efi_fpsimd_end(void)
 							   0,
 							   SVCR_SM_MASK);
 					if (!system_supports_fa64())
-						ffr = efi_sm_state;
+						ffr = false;
 				}
 			}
 
-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: kernel test robot <lkp@intel.com>
Cc: Mark Brown <broonie@kernel.org>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: Re: arch/arm64/kernel/fpsimd.c:1944:55: sparse: sparse: dereference of noderef expression
Date: Tue, 31 May 2022 17:57:42 +0100	[thread overview]
Message-ID: <YpZJBoxqvaCLRQfX@arm.com> (raw)
In-Reply-To: <202205280635.XKlMkfKD-lkp@intel.com>

On Sat, May 28, 2022 at 06:49:01AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   8291eaafed36f575f23951f3ce18407f480e9ecf
> commit: e0838f6373e5cb72516fc4c26bba309097e2a80a arm64/sme: Save and restore streaming mode over EFI runtime calls
> date:   5 weeks ago
> config: arm64-randconfig-s032-20220527 (https://download.01.org/0day-ci/archive/20220528/202205280635.XKlMkfKD-lkp@intel.com/config)
> compiler: aarch64-linux-gcc (GCC) 11.3.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.4-14-g5a0004b5-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e0838f6373e5cb72516fc4c26bba309097e2a80a
>         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>         git fetch --no-tags linus master
>         git checkout e0838f6373e5cb72516fc4c26bba309097e2a80a
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash arch/arm64/kernel/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
> >> arch/arm64/kernel/fpsimd.c:1944:55: sparse: sparse: dereference of noderef expression
> 
> vim +1944 arch/arm64/kernel/fpsimd.c
> 
>   1916	
>   1917	/*
>   1918	 * __efi_fpsimd_end(): clean up FPSIMD after an EFI runtime services call
>   1919	 */
>   1920	void __efi_fpsimd_end(void)
>   1921	{
>   1922		if (!system_supports_fpsimd())
>   1923			return;
>   1924	
>   1925		if (!__this_cpu_xchg(efi_fpsimd_state_used, false)) {
>   1926			kernel_neon_end();
>   1927		} else {
>   1928			if (system_supports_sve() &&
>   1929			    likely(__this_cpu_read(efi_sve_state_used))) {
>   1930				char const *sve_state = this_cpu_ptr(efi_sve_state);
>   1931				bool ffr = true;
>   1932	
>   1933				/*
>   1934				 * Restore streaming mode; EFI calls are
>   1935				 * normal function calls so should not return in
>   1936				 * streaming mode.
>   1937				 */
>   1938				if (system_supports_sme()) {
>   1939					if (__this_cpu_read(efi_sm_state)) {
>   1940						sysreg_clear_set_s(SYS_SVCR_EL0,
>   1941								   0,
>   1942								   SYS_SVCR_EL0_SM_MASK);
>   1943						if (!system_supports_fa64())
> > 1944							ffr = efi_sm_state;

This looks wrong indeed. IIUC, something like below but waiting for Mark
to confirm:

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index 819979398127..ac521b3403d6 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -1965,7 +1965,7 @@ void __efi_fpsimd_end(void)
 							   0,
 							   SVCR_SM_MASK);
 					if (!system_supports_fa64())
-						ffr = efi_sm_state;
+						ffr = false;
 				}
 			}
 
-- 
Catalin

  reply	other threads:[~2022-05-31 16:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 22:49 arch/arm64/kernel/fpsimd.c:1944:55: sparse: sparse: dereference of noderef expression kernel test robot
2022-05-31 16:57 ` Catalin Marinas [this message]
2022-05-31 16:57   ` Catalin Marinas
2022-06-01  7:50   ` Mark Brown
2022-06-01  7:50     ` Mark Brown
2022-06-01 16:54     ` Catalin Marinas
2022-06-01 16:54       ` Catalin Marinas
2022-06-02  8:22       ` Mark Brown
2022-06-02  8:22         ` Mark Brown

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=YpZJBoxqvaCLRQfX@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.