[l1k:smsc95xx_5.17 74/888] arch/arm/lib/uaccess_with_memcpy.c:211:30: warning: variable 'temp' set but not used

From: kernel test robot
Date: Sat Apr 09 2022 - 17:32:18 EST


tree: https://github.com/l1k/linux smsc95xx_5.17
head: 240f56c27361c195cd502d95aba51c6b8e5b808c
commit: 375b90433562ce3545ccda0376716268ff974114 [74/888] Improve __copy_to_user and __copy_from_user performance
config: arm-randconfig-c003-20220408 (https://download.01.org/0day-ci/archive/20220410/202204100511.otOdzGCX-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/l1k/linux/commit/375b90433562ce3545ccda0376716268ff974114
git remote add l1k https://github.com/l1k/linux
git fetch --no-tags l1k smsc95xx_5.17
git checkout 375b90433562ce3545ccda0376716268ff974114
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

arm-linux-gnueabi-ld: arch/arm/mm/proc-xscale.o: in function `xscale_dma_unmap_area':
>> (.text+0x25c): undefined reference to `xscale_80200_A0_A1_dma_inv_range'
arm-linux-gnueabi-ld: (.text+0x260): undefined reference to `xscale_80200_A0_A1_dma_clean_range'
arm-linux-gnueabi-ld: arch/arm/mm/proc-syms.o:(___ksymtab+xscale_dma_clean_range+0x0): undefined reference to `xscale_dma_clean_range'
arm-linux-gnueabi-ld: arch/arm/mm/proc-syms.o:(___ksymtab+xscale_dma_inv_range+0x0): undefined reference to `xscale_dma_inv_range'
--
arch/arm/lib/uaccess_with_memcpy.c:137:1: warning: no previous prototype for '__copy_to_user_memcpy' [-Wmissing-prototypes]
137 | __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n)
| ^~~~~~~~~~~~~~~~~~~~~
arch/arm/lib/uaccess_with_memcpy.c:190:1: warning: no previous prototype for '__copy_from_user_memcpy' [-Wmissing-prototypes]
190 | __copy_from_user_memcpy(void *to, const void __user *from, unsigned long n)
| ^~~~~~~~~~~~~~~~~~~~~~~
arch/arm/lib/uaccess_with_memcpy.c: In function '__copy_from_user_memcpy':
>> arch/arm/lib/uaccess_with_memcpy.c:211:30: warning: variable 'temp' set but not used [-Wunused-but-set-variable]
211 | char temp;
| ^~~~


vim +/temp +211 arch/arm/lib/uaccess_with_memcpy.c

188
189 unsigned long noinline
190 __copy_from_user_memcpy(void *to, const void __user *from, unsigned long n)
191 {
192 unsigned long ua_flags;
193 int atomic;
194
195 if (unlikely(uaccess_kernel())) {
196 memcpy(to, (const void *)from, n);
197 return 0;
198 }
199
200 /* the mmap semaphore is taken only if not in an atomic context */
201 atomic = in_atomic();
202
203 if (!atomic)
204 mmap_read_lock(current->mm);
205 while (n) {
206 pte_t *pte;
207 spinlock_t *ptl;
208 int tocopy;
209
210 while (!pin_page_for_read(from, &pte, &ptl)) {
> 211 char temp;
212 if (!atomic)
213 mmap_read_unlock(current->mm);
214 if (__get_user(temp, (char __user *)from))
215 goto out;
216 if (!atomic)
217 mmap_read_lock(current->mm);
218 }
219
220 tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1;
221 if (tocopy > n)
222 tocopy = n;
223
224 ua_flags = uaccess_save_and_enable();
225 memcpy(to, (const void *)from, tocopy);
226 uaccess_restore(ua_flags);
227 to += tocopy;
228 from += tocopy;
229 n -= tocopy;
230
231 pte_unmap_unlock(pte, ptl);
232 }
233 if (!atomic)
234 mmap_read_unlock(current->mm);
235
236 out:
237 return n;
238 }
239

--
0-DAY CI Kernel Test Service
https://01.org/lkp