Skip to content

Commit 869436d

Browse files
bjdooks-ctpalmer-dabbelt
authored andcommitted
riscv; fix __user annotation in save_v_state()
The save_v_state() is technically sending a __user pointer through __put_user() and thus is generating a sparse warning so force the value to be "void *" to fix: arch/riscv/kernel/signal.c:94:16: warning: incorrect type in initializer (different address spaces) arch/riscv/kernel/signal.c:94:16: expected void *__val arch/riscv/kernel/signal.c:94:16: got void [noderef] __user *[assigned] datap Fixes: 8ee0b41 ("riscv: signal: Add sigcontext save/restore for vector") Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Link: https://lore.kernel.org/r/20231123142708.261733-1-ben.dooks@codethink.co.uk Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent ca0e433 commit 869436d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/riscv/kernel/signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static long save_v_state(struct pt_regs *regs, void __user **sc_vec)
9191
err = __copy_to_user(&state->v_state, &current->thread.vstate,
9292
offsetof(struct __riscv_v_ext_state, datap));
9393
/* Copy the pointer datap itself. */
94-
err |= __put_user(datap, &state->v_state.datap);
94+
err |= __put_user((__force void *)datap, &state->v_state.datap);
9595
/* Copy the whole vector content to user space datap. */
9696
err |= __copy_to_user(datap, current->thread.vstate.datap, riscv_v_vsize);
9797
/* Copy magic to the user space after saving all vector conetext */

0 commit comments

Comments
 (0)