[arnd-playground:generic-get_user-prototype 3/3] include/linux/uaccess.h:546:4: warning: variable 'v' set but not used

From: kernel test robot
Date: Mon Feb 21 2022 - 06:55:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git generic-get_user-prototype
head: 23cc2497095e8c0820d042f28c507aded31674c1
commit: 23cc2497095e8c0820d042f28c507aded31674c1 [3/3] uaccess: add new generic get_user/put_user
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220221/202202211934.btUGYgRN-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=23cc2497095e8c0820d042f28c507aded31674c1
git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
git fetch --no-tags arnd-playground generic-get_user-prototype
git checkout 23cc2497095e8c0820d042f28c507aded31674c1
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/entry/vdso/

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

All warnings (new ones prefixed by >>):

In file included from include/linux/sched/task.h:11,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/irq_work.h:6,
from arch/x86/include/asm/nmi.h:5,
from include/linux/nmi.h:212,
from arch/x86/include/asm/mshyperv.h:6,
from include/clocksource/hyperv_timer.h:18,
from arch/x86/include/asm/vdso/gettimeofday.h:21,
from include/vdso/datapage.h:137,
from arch/x86/entry/vdso/vdso32/../../../../../lib/vdso/gettimeofday.c:5,
from arch/x86/entry/vdso/vdso32/../vclock_gettime.c:15,
from arch/x86/entry/vdso/vdso32/vclock_gettime.c:29:
include/linux/uaccess.h: In function 'raw_put_user_u64':
>> include/linux/uaccess.h:546:4: warning: variable 'v' set but not used [-Wunused-but-set-variable]
546 | } v;
| ^
In file included from arch/x86/entry/vdso/vdso32/vclock_gettime.c:29:
arch/x86/entry/vdso/vdso32/../vclock_gettime.c: At top level:
arch/x86/entry/vdso/vdso32/../vclock_gettime.c:70:5: warning: no previous prototype for '__vdso_clock_gettime64' [-Wmissing-prototypes]
70 | int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
| ^~~~~~~~~~~~~~~~~~~~~~


vim +/v +546 include/linux/uaccess.h

538
539 #ifndef CONFIG_64BIT
540 static __always_inline int
541 raw_put_user_u64(u64 __user *to, u64 val, size_t size, bool check)
542 {
543 union {
544 u64 v64;
545 u32 v32[2];
> 546 } v;
547 int err;
548
549 if (check) {
550 if (!access_ok(to, size))
551 return -EFAULT;
552 might_fault();
553 }
554 if (0)
555 goto out;
556
557 __uaccess_begin_nospec();
558
559 v.v64 = val;
560 err = 0;
561 #ifdef __put_user_asm_8
562 __put_user_asm_8(val, to, err, out);
563 #else
564 __put_user_asm_4(v.v32[0], (u32 __user*)to, err, out);
565 if (!err)
566 __put_user_asm_4(v.v32[1], (u32 __user*)to + 1, err, out);
567 #endif
568 __uaccess_end();
569 return err;
570 out:
571 __uaccess_end();
572 return -EFAULT;
573 }
574 #define raw_put_user_word(to, val, err, out) \
575 __builtin_choose_expr(sizeof(*to) == 8, \
576 raw_put_user_u64, raw_put_user_word)(to, val, err, out)
577 #endif
578

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx