Skip to contentSkip to conversation

arch/riscv/kernel/ptrace.c:123:18: warning: unused variable 'size'

PATCH kernel test robot 2 participants 2 messages Aug 30, 2023

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git for-next
head:   046ba817faa2e609c3751e2ee388d427fe9dd470
commit: dbe46b0940261301a038bbe1d699b29158b35a8d [83/84] RISC-V: Add ptrace support for vectors
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20230831/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230831/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

arch/riscv/kernel/ptrace.c: In function 'riscv_vr_set':

>> arch/riscv/kernel/ptrace.c:123:18: warning: unused variable 'size' [-Wunused-variable]
     123 |         int ret, size;
         |                  ^~~~

vim +/size +123 arch/riscv/kernel/ptrace.c

117
118 static int riscv_vr_set(struct task_struct *target,
119 const struct user_regset *regset,
120 unsigned int pos, unsigned int count,
121 const void *kbuf, const void __user *ubuf)
122 {

 > 123		int ret, size;

124 struct __riscv_v_ext_state *vstate = &target->thread.vstate;
125 struct __riscv_v_regset_state ptrace_vstate;
126
127 if (!riscv_v_vstate_query(task_pt_regs(target)))
128 return -EINVAL;
129
130 /* Copy rest of the vstate except datap */
131 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ptrace_vstate, 0,
132 sizeof(struct __riscv_v_regset_state));
133 if (unlikely(ret))
134 return ret;
135
136 if (vstate->vlenb != ptrace_vstate.vlenb)
137 return -EINVAL;
138
139 vstate->vstart = ptrace_vstate.vstart;
140 vstate->vl = ptrace_vstate.vl;
141 vstate->vtype = ptrace_vstate.vtype;
142 vstate->vcsr = ptrace_vstate.vcsr;
143
144 /* Copy all the vector registers. */
145 pos = 0;
146 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, vstate->datap,
147 0, riscv_v_vsize);
148 return ret;
149 }
150 #endif
151

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 49 lines · On Wed, 30 Aug 2023 12:59:21 PDT (-0700), [email protected] wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git for-next
head:   046ba817faa2e609c3751e2ee388d427fe9dd470
commit: dbe46b0940261301a038bbe1d699b29158b35a8d [83/84] RISC-V: Add ptrace support for vectors
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20230831/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230831/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

arch/riscv/kernel/ptrace.c: In function 'riscv_vr_set':

Quoted 1 line
Quoted 1 line

arch/riscv/kernel/ptrace.c:123:18: warning: unused variable 'size' [-Wunused-variable]

     123 |         int ret, size;
         |                  ^~~~

vim +/size +123 arch/riscv/kernel/ptrace.c

117
118 static int riscv_vr_set(struct task_struct *target,
119 const struct user_regset *regset,
120 unsigned int pos, unsigned int count,
121 const void *kbuf, const void __user *ubuf)
122 {

Quoted 1 line

123 int ret, size;

   124		struct __riscv_v_ext_state *vstate = &target->thread.vstate;
   125		struct __riscv_v_regset_state ptrace_vstate;
   126
   127		if (!riscv_v_vstate_query(task_pt_regs(target)))
   128			return -EINVAL;
   129
   130		/* Copy rest of the vstate except datap */
   131		ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ptrace_vstate, 0,
   132					 sizeof(struct __riscv_v_regset_state));
   133		if (unlikely(ret))
   134			return ret;
   135
   136		if (vstate->vlenb != ptrace_vstate.vlenb)
   137			return -EINVAL;
   138
   139		vstate->vstart = ptrace_vstate.vstart;
   140		vstate->vl = ptrace_vstate.vl;
   141		vstate->vtype = ptrace_vstate.vtype;
   142		vstate->vcsr = ptrace_vstate.vcsr;
   143
Quoted 8 lines
   144		/* Copy all the vector registers. */
   145		pos = 0;
   146		ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, vstate->datap,
   147					 0, riscv_v_vsize);
   148		return ret;
   149	}
   150	#endif
   151

Thanks, https://lore.kernel.org/r/[email protected]/ should fix it.