From: kernel test robot <lkp@intel.com>
To: Guo Ren <guoren@linux.alibaba.com>
Cc: oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Palmer Dabbelt <palmer@rivosinc.com>,
Greentime Hu <greentime.hu@sifive.com>,
Andy Chiu <andy.chiu@sifive.com>,
Conor Dooley <conor.dooley@microchip.com>
Subject: [linux-next:master 6420/10326] arch/riscv/kernel/signal.c:94:16: sparse: sparse: incorrect type in initializer (different address spaces)
Date: Thu, 15 Jun 2023 19:36:33 +0800 [thread overview]
Message-ID: <202306151954.Rsz6HP7h-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 925294c9aa184801cc0a451b69a18dd0fe7d847d
commit: fa8e7cce55da3569259dc270801885c420eb50fe [6420/10326] riscv: Enable Vector code to be built
config: riscv-randconfig-s031-20230611 (https://download.01.org/0day-ci/archive/20230615/202306151954.Rsz6HP7h-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 12.3.0
reproduce:
mkdir -p ~/bin
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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=fa8e7cce55da3569259dc270801885c420eb50fe
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout fa8e7cce55da3569259dc270801885c420eb50fe
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.3.0 ~/bin/make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash arch/riscv/kernel/
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202306151954.Rsz6HP7h-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
WARNING: invalid argument to '-march': '_zihintpause'
>> arch/riscv/kernel/signal.c:94:16: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void *__val @@ got void [noderef] __user *[assigned] datap @@
arch/riscv/kernel/signal.c:94:16: sparse: expected void *__val
arch/riscv/kernel/signal.c:94:16: sparse: got void [noderef] __user *[assigned] datap
vim +94 arch/riscv/kernel/signal.c
8ee0b41898fa26 Greentime Hu 2023-06-05 72
8ee0b41898fa26 Greentime Hu 2023-06-05 73 static long save_v_state(struct pt_regs *regs, void __user **sc_vec)
8ee0b41898fa26 Greentime Hu 2023-06-05 74 {
8ee0b41898fa26 Greentime Hu 2023-06-05 75 struct __riscv_ctx_hdr __user *hdr;
8ee0b41898fa26 Greentime Hu 2023-06-05 76 struct __sc_riscv_v_state __user *state;
8ee0b41898fa26 Greentime Hu 2023-06-05 77 void __user *datap;
8ee0b41898fa26 Greentime Hu 2023-06-05 78 long err;
8ee0b41898fa26 Greentime Hu 2023-06-05 79
8ee0b41898fa26 Greentime Hu 2023-06-05 80 hdr = *sc_vec;
8ee0b41898fa26 Greentime Hu 2023-06-05 81 /* Place state to the user's signal context space after the hdr */
8ee0b41898fa26 Greentime Hu 2023-06-05 82 state = (struct __sc_riscv_v_state __user *)(hdr + 1);
8ee0b41898fa26 Greentime Hu 2023-06-05 83 /* Point datap right after the end of __sc_riscv_v_state */
8ee0b41898fa26 Greentime Hu 2023-06-05 84 datap = state + 1;
8ee0b41898fa26 Greentime Hu 2023-06-05 85
8ee0b41898fa26 Greentime Hu 2023-06-05 86 /* datap is designed to be 16 byte aligned for better performance */
8ee0b41898fa26 Greentime Hu 2023-06-05 87 WARN_ON(unlikely(!IS_ALIGNED((unsigned long)datap, 16)));
8ee0b41898fa26 Greentime Hu 2023-06-05 88
8ee0b41898fa26 Greentime Hu 2023-06-05 89 riscv_v_vstate_save(current, regs);
8ee0b41898fa26 Greentime Hu 2023-06-05 90 /* Copy everything of vstate but datap. */
8ee0b41898fa26 Greentime Hu 2023-06-05 91 err = __copy_to_user(&state->v_state, ¤t->thread.vstate,
8ee0b41898fa26 Greentime Hu 2023-06-05 92 offsetof(struct __riscv_v_ext_state, datap));
8ee0b41898fa26 Greentime Hu 2023-06-05 93 /* Copy the pointer datap itself. */
8ee0b41898fa26 Greentime Hu 2023-06-05 @94 err |= __put_user(datap, &state->v_state.datap);
8ee0b41898fa26 Greentime Hu 2023-06-05 95 /* Copy the whole vector content to user space datap. */
8ee0b41898fa26 Greentime Hu 2023-06-05 96 err |= __copy_to_user(datap, current->thread.vstate.datap, riscv_v_vsize);
8ee0b41898fa26 Greentime Hu 2023-06-05 97 /* Copy magic to the user space after saving all vector conetext */
8ee0b41898fa26 Greentime Hu 2023-06-05 98 err |= __put_user(RISCV_V_MAGIC, &hdr->magic);
8ee0b41898fa26 Greentime Hu 2023-06-05 99 err |= __put_user(riscv_v_sc_size, &hdr->size);
8ee0b41898fa26 Greentime Hu 2023-06-05 100 if (unlikely(err))
8ee0b41898fa26 Greentime Hu 2023-06-05 101 return err;
8ee0b41898fa26 Greentime Hu 2023-06-05 102
8ee0b41898fa26 Greentime Hu 2023-06-05 103 /* Only progress the sv_vec if everything has done successfully */
8ee0b41898fa26 Greentime Hu 2023-06-05 104 *sc_vec += riscv_v_sc_size;
8ee0b41898fa26 Greentime Hu 2023-06-05 105 return 0;
8ee0b41898fa26 Greentime Hu 2023-06-05 106 }
8ee0b41898fa26 Greentime Hu 2023-06-05 107
:::::: The code at line 94 was first introduced by commit
:::::: 8ee0b41898fa26f66e32237f179b6989c65600d6 riscv: signal: Add sigcontext save/restore for vector
:::::: TO: Greentime Hu <greentime.hu@sifive.com>
:::::: CC: Palmer Dabbelt <palmer@rivosinc.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-06-15 11:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202306151954.Rsz6HP7h-lkp@intel.com \
--to=lkp@intel.com \
--cc=andy.chiu@sifive.com \
--cc=conor.dooley@microchip.com \
--cc=greentime.hu@sifive.com \
--cc=guoren@linux.alibaba.com \
--cc=linux-mm@kvack.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=palmer@rivosinc.com \
/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).