[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202409210356.qCeOh9PA-lkp@intel.com>
Date: Sat, 21 Sep 2024 01:20:57 +0800
From: kernel test robot <lkp@...el.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Palmer Dabbelt <palmer@...osinc.com>,
Andy Chiu <andybnac@...il.com>,
Conor Dooley <conor.dooley@...rochip.com>
Subject: arch/riscv/kernel/signal.c:129:15: sparse: sparse: incorrect type in
assignment (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: baeb9a7d8b60b021d907127509c44507539c15e5
commit: 3aff0c459e77ac0fb1c4d6884433467f797f7357 RISC-V: Drop invalid test from CONFIG_AS_HAS_OPTION_ARCH
date: 7 months ago
config: riscv-randconfig-r113-20240920 (https://download.01.org/0day-ci/archive/20240921/202409210356.qCeOh9PA-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 8663a75fa2f31299ab8d1d90288d9df92aadee88)
reproduce: (https://download.01.org/0day-ci/archive/20240921/202409210356.qCeOh9PA-lkp@intel.com/reproduce)
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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409210356.qCeOh9PA-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> arch/riscv/kernel/signal.c:129:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user *datap @@ got void * @@
arch/riscv/kernel/signal.c:129:15: sparse: expected void [noderef] __user *datap
arch/riscv/kernel/signal.c:129:15: sparse: got void *
>> arch/riscv/kernel/signal.c:129:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user *datap @@ got void * @@
arch/riscv/kernel/signal.c:129:15: sparse: expected void [noderef] __user *datap
arch/riscv/kernel/signal.c:129:15: sparse: got void *
>> arch/riscv/kernel/signal.c:129:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user *datap @@ got void * @@
arch/riscv/kernel/signal.c:129:15: sparse: expected void [noderef] __user *datap
arch/riscv/kernel/signal.c:129:15: sparse: got void *
>> arch/riscv/kernel/signal.c:129:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user *datap @@ got void * @@
arch/riscv/kernel/signal.c:129:15: sparse: expected void [noderef] __user *datap
arch/riscv/kernel/signal.c:129:15: sparse: got void *
vim +129 arch/riscv/kernel/signal.c
8ee0b41898fa26 Greentime Hu 2023-06-05 110
8ee0b41898fa26 Greentime Hu 2023-06-05 111 /*
8ee0b41898fa26 Greentime Hu 2023-06-05 112 * Restore Vector extension context from the user's signal frame. This function
8ee0b41898fa26 Greentime Hu 2023-06-05 113 * assumes a valid extension header. So magic and size checking must be done by
8ee0b41898fa26 Greentime Hu 2023-06-05 114 * the caller.
8ee0b41898fa26 Greentime Hu 2023-06-05 115 */
8ee0b41898fa26 Greentime Hu 2023-06-05 116 static long __restore_v_state(struct pt_regs *regs, void __user *sc_vec)
8ee0b41898fa26 Greentime Hu 2023-06-05 117 {
8ee0b41898fa26 Greentime Hu 2023-06-05 118 long err;
8ee0b41898fa26 Greentime Hu 2023-06-05 119 struct __sc_riscv_v_state __user *state = sc_vec;
8ee0b41898fa26 Greentime Hu 2023-06-05 120 void __user *datap;
8ee0b41898fa26 Greentime Hu 2023-06-05 121
8ee0b41898fa26 Greentime Hu 2023-06-05 122 /* Copy everything of __sc_riscv_v_state except datap. */
8ee0b41898fa26 Greentime Hu 2023-06-05 123 err = __copy_from_user(¤t->thread.vstate, &state->v_state,
8ee0b41898fa26 Greentime Hu 2023-06-05 124 offsetof(struct __riscv_v_ext_state, datap));
8ee0b41898fa26 Greentime Hu 2023-06-05 125 if (unlikely(err))
8ee0b41898fa26 Greentime Hu 2023-06-05 126 return err;
8ee0b41898fa26 Greentime Hu 2023-06-05 127
8ee0b41898fa26 Greentime Hu 2023-06-05 128 /* Copy the pointer datap itself. */
8ee0b41898fa26 Greentime Hu 2023-06-05 @129 err = __get_user(datap, &state->v_state.datap);
8ee0b41898fa26 Greentime Hu 2023-06-05 130 if (unlikely(err))
8ee0b41898fa26 Greentime Hu 2023-06-05 131 return err;
8ee0b41898fa26 Greentime Hu 2023-06-05 132 /*
8ee0b41898fa26 Greentime Hu 2023-06-05 133 * Copy the whole vector content from user space datap. Use
8ee0b41898fa26 Greentime Hu 2023-06-05 134 * copy_from_user to prevent information leak.
8ee0b41898fa26 Greentime Hu 2023-06-05 135 */
8ee0b41898fa26 Greentime Hu 2023-06-05 136 err = copy_from_user(current->thread.vstate.datap, datap, riscv_v_vsize);
8ee0b41898fa26 Greentime Hu 2023-06-05 137 if (unlikely(err))
8ee0b41898fa26 Greentime Hu 2023-06-05 138 return err;
8ee0b41898fa26 Greentime Hu 2023-06-05 139
7df56cbc27e423 Andy Chiu 2024-01-15 140 riscv_v_vstate_set_restore(current, regs);
8ee0b41898fa26 Greentime Hu 2023-06-05 141
8ee0b41898fa26 Greentime Hu 2023-06-05 142 return err;
8ee0b41898fa26 Greentime Hu 2023-06-05 143 }
8ee0b41898fa26 Greentime Hu 2023-06-05 144 #else
8ee0b41898fa26 Greentime Hu 2023-06-05 145 #define save_v_state(task, regs) (0)
8ee0b41898fa26 Greentime Hu 2023-06-05 146 #define __restore_v_state(task, regs) (0)
8ee0b41898fa26 Greentime Hu 2023-06-05 147 #endif
8ee0b41898fa26 Greentime Hu 2023-06-05 148
:::::: The code at line 129 was first introduced by commit
:::::: 8ee0b41898fa26f66e32237f179b6989c65600d6 riscv: signal: Add sigcontext save/restore for vector
:::::: TO: Greentime Hu <greentime.hu@...ive.com>
:::::: CC: Palmer Dabbelt <palmer@...osinc.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists