All of lore.kernel.org
 help / color / mirror / Atom feed
* arch/riscv/kernel/signal.c:126 __restore_v_state() warn: maybe return -EFAULT instead of the bytes remaining?
@ 2024-12-26 11:29 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-12-26 11:29 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Nathan Chancellor <nathan@kernel.org>
CC: Palmer Dabbelt <palmer@rivosinc.com>
CC: Andy Chiu <andybnac@gmail.com>
CC: Conor Dooley <conor.dooley@microchip.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9b2ffa6148b1e4468d08f7e0e7e371c43cac9ffe
commit: 3aff0c459e77ac0fb1c4d6884433467f797f7357 RISC-V: Drop invalid test from CONFIG_AS_HAS_OPTION_ARCH
date:   10 months ago
:::::: branch date: 2 days ago
:::::: commit date: 10 months ago
config: riscv-randconfig-r073-20241225 (https://download.01.org/0day-ci/archive/20241226/202412261919.8WV3iSqf-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202412261919.8WV3iSqf-lkp@intel.com/

New smatch warnings:
arch/riscv/kernel/signal.c:126 __restore_v_state() warn: maybe return -EFAULT instead of the bytes remaining?

Old smatch warnings:
arch/riscv/kernel/signal.c:50 restore_fp_state() warn: maybe return -EFAULT instead of the bytes remaining?
arch/riscv/kernel/signal.c:64 save_fp_state() warn: maybe return -EFAULT instead of the bytes remaining?
arch/riscv/kernel/signal.c:138 __restore_v_state() warn: maybe return -EFAULT instead of the bytes remaining?
arch/riscv/kernel/signal.c:158 restore_sigcontext() warn: maybe return -EFAULT instead of the bytes remaining?

vim +126 arch/riscv/kernel/signal.c

8ee0b41898fa26f Greentime Hu 2023-06-05  110  
8ee0b41898fa26f Greentime Hu 2023-06-05  111  /*
8ee0b41898fa26f Greentime Hu 2023-06-05  112   * Restore Vector extension context from the user's signal frame. This function
8ee0b41898fa26f Greentime Hu 2023-06-05  113   * assumes a valid extension header. So magic and size checking must be done by
8ee0b41898fa26f Greentime Hu 2023-06-05  114   * the caller.
8ee0b41898fa26f Greentime Hu 2023-06-05  115   */
8ee0b41898fa26f Greentime Hu 2023-06-05  116  static long __restore_v_state(struct pt_regs *regs, void __user *sc_vec)
8ee0b41898fa26f Greentime Hu 2023-06-05  117  {
8ee0b41898fa26f Greentime Hu 2023-06-05  118  	long err;
8ee0b41898fa26f Greentime Hu 2023-06-05  119  	struct __sc_riscv_v_state __user *state = sc_vec;
8ee0b41898fa26f Greentime Hu 2023-06-05  120  	void __user *datap;
8ee0b41898fa26f Greentime Hu 2023-06-05  121  
8ee0b41898fa26f Greentime Hu 2023-06-05  122  	/* Copy everything of __sc_riscv_v_state except datap. */
8ee0b41898fa26f Greentime Hu 2023-06-05  123  	err = __copy_from_user(&current->thread.vstate, &state->v_state,
8ee0b41898fa26f Greentime Hu 2023-06-05  124  			       offsetof(struct __riscv_v_ext_state, datap));
8ee0b41898fa26f Greentime Hu 2023-06-05  125  	if (unlikely(err))
8ee0b41898fa26f Greentime Hu 2023-06-05 @126  		return err;
8ee0b41898fa26f Greentime Hu 2023-06-05  127  
8ee0b41898fa26f Greentime Hu 2023-06-05  128  	/* Copy the pointer datap itself. */
8ee0b41898fa26f Greentime Hu 2023-06-05  129  	err = __get_user(datap, &state->v_state.datap);
8ee0b41898fa26f Greentime Hu 2023-06-05  130  	if (unlikely(err))
8ee0b41898fa26f Greentime Hu 2023-06-05  131  		return err;
8ee0b41898fa26f Greentime Hu 2023-06-05  132  	/*
8ee0b41898fa26f Greentime Hu 2023-06-05  133  	 * Copy the whole vector content from user space datap. Use
8ee0b41898fa26f Greentime Hu 2023-06-05  134  	 * copy_from_user to prevent information leak.
8ee0b41898fa26f Greentime Hu 2023-06-05  135  	 */
8ee0b41898fa26f Greentime Hu 2023-06-05  136  	err = copy_from_user(current->thread.vstate.datap, datap, riscv_v_vsize);
8ee0b41898fa26f Greentime Hu 2023-06-05  137  	if (unlikely(err))
8ee0b41898fa26f Greentime Hu 2023-06-05  138  		return err;
8ee0b41898fa26f Greentime Hu 2023-06-05  139  
7df56cbc27e4239 Andy Chiu    2024-01-15  140  	riscv_v_vstate_set_restore(current, regs);
8ee0b41898fa26f Greentime Hu 2023-06-05  141  
8ee0b41898fa26f Greentime Hu 2023-06-05  142  	return err;
8ee0b41898fa26f Greentime Hu 2023-06-05  143  }
8ee0b41898fa26f Greentime Hu 2023-06-05  144  #else
8ee0b41898fa26f Greentime Hu 2023-06-05  145  #define save_v_state(task, regs) (0)
8ee0b41898fa26f Greentime Hu 2023-06-05  146  #define __restore_v_state(task, regs) (0)
8ee0b41898fa26f Greentime Hu 2023-06-05  147  #endif
8ee0b41898fa26f Greentime Hu 2023-06-05  148  

:::::: The code at line 126 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-26 11:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-26 11:29 arch/riscv/kernel/signal.c:126 __restore_v_state() warn: maybe return -EFAULT instead of the bytes remaining? kernel test robot

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.