Skip to contentSkip to conversation

arch/riscv/include/asm/uaccess.h:115:15: warning: cast to pointer from integer of different size

PATCH kernel test robot 1 participant 1 message Jan 20

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   053966c344dbd346e71305f530e91ea77916189f
commit: bdce162f2e57a969803e5e9375999a3e0546905f [6722/8302] riscv: Use 64-bit variable for output in __get_user_asm
config: riscv-randconfig-r064-20260121 (https://download.01.org/0day-ci/archive/20260121/[email protected]/config)
compiler: riscv32-linux-gcc (GCC) 14.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260121/[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 >>):

In file included from include/linux/uaccess.h:13,

                    from include/linux/sched/task.h:13,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/mm.h:36,
                    from include/linux/migrate.h:5,
                    from mm/migrate.c:16:
   mm/migrate.c: In function 'do_pages_move':
>> arch/riscv/include/asm/uaccess.h:115:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     115 |         (x) = (__typeof__(x))__tmp;                             \
         |               ^
   arch/riscv/include/asm/uaccess.h:198:17: note: in expansion of macro '__get_user_asm'
     198 |                 __get_user_asm("lb", (x), __gu_ptr, label);     \
         |                 ^~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:218:9: note: in expansion of macro '__get_user_nocheck'
     218 |         __get_user_nocheck(x, ptr, __gu_failed);                        \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:255:9: note: in expansion of macro '__get_user_error'
     255 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:285:17: note: in expansion of macro '__get_user'
     285 |                 __get_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   mm/migrate.c:2358:29: note: in expansion of macro 'get_user'
    2358 |                         if (get_user(p, pages + i))
         |                             ^~~~~~~~
>> arch/riscv/include/asm/uaccess.h:115:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     115 |         (x) = (__typeof__(x))__tmp;                             \
         |               ^
   arch/riscv/include/asm/uaccess.h:201:17: note: in expansion of macro '__get_user_asm'
     201 |                 __get_user_asm("lh", (x), __gu_ptr, label);     \
         |                 ^~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:218:9: note: in expansion of macro '__get_user_nocheck'
     218 |         __get_user_nocheck(x, ptr, __gu_failed);                        \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:255:9: note: in expansion of macro '__get_user_error'
     255 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:285:17: note: in expansion of macro '__get_user'
     285 |                 __get_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   mm/migrate.c:2358:29: note: in expansion of macro 'get_user'
    2358 |                         if (get_user(p, pages + i))
         |                             ^~~~~~~~
>> arch/riscv/include/asm/uaccess.h:115:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     115 |         (x) = (__typeof__(x))__tmp;                             \
         |               ^
   arch/riscv/include/asm/uaccess.h:204:17: note: in expansion of macro '__get_user_asm'
     204 |                 __get_user_asm("lw", (x), __gu_ptr, label);     \
         |                 ^~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:218:9: note: in expansion of macro '__get_user_nocheck'
     218 |         __get_user_nocheck(x, ptr, __gu_failed);                        \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:255:9: note: in expansion of macro '__get_user_error'
     255 |         __get_user_error(__gu_val, __gu_ptr, __gu_err);         \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:285:17: note: in expansion of macro '__get_user'
     285 |                 __get_user((x), __p) :                          \
         |                 ^~~~~~~~~~

mm/migrate.c:2358:29: note: in expansion of macro 'get_user'
2358 | if (get_user(p, pages + i))
| ^~~~~~~~

vim +115 arch/riscv/include/asm/uaccess.h

    92	
    93	/*
    94	 * The "__xxx" versions of the user access functions do not verify the address
    95	 * space - it must have been done previously with a separate "access_ok()"
    96	 * call.
    97	 */
    98	
    99	#ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
   100	/*
   101	 * Use a temporary variable for the output of the asm goto to avoid a
   102	 * triggering an LLVM assertion due to sign extending the output when
   103	 * it is used in later function calls:
   104	 * https://github.com/llvm/llvm-project/issues/143795
   105	 */
   106	#define __get_user_asm(insn, x, ptr, label)			\
   107	do {								\
   108		u64 __tmp;						\
   109		asm_goto_output(					\
   110			"1:\n"						\
   111			"	" insn " %0, %1\n"			\
   112			_ASM_EXTABLE_UACCESS_ERR(1b, %l2, %0)		\
   113			: "=&r" (__tmp)					\
   114			: "m" (*(ptr)) : : label);			\
 > 115		(x) = (__typeof__(x))__tmp;				\

116 } while (0)
117 #else /* !CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
118 #define __get_user_asm(insn, x, ptr, label) \
119 do { \
120 long __gua_err = 0; \
121 __asm__ __volatile__ ( \
122 "1:\n" \
123 " " insn " %1, %2\n" \
124 "2:\n" \
125 _ASM_EXTABLE_UACCESS_ERR_ZERO(1b, 2b, %0, %1) \
126 : "+r" (__gua_err), "=&r" (x) \
127 : "m" (*(ptr))); \
128 if (__gua_err) \
129 goto label; \
130 } while (0)
131 #endif /* CONFIG_CC_HAS_ASM_GOTO_OUTPUT */
132

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki