diff mbox

gpu/drm: Use u64_to_user_pointer

Message ID b70b7949e8344abe13d85d6e8e5a8e11bb9c5f02.1458321299.git.joe@perches.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joe Perches March 18, 2016, 5:20 p.m. UTC
Use the newly added u64_to_user_pointer a bit more frequently.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/gpu/drm/armada/armada_gem.c    |  2 +-
 drivers/gpu/drm/nouveau/nouveau_gem.c  |  7 ++++---
 drivers/gpu/drm/tegra/drm.c            | 15 ++++++++-------
 drivers/gpu/drm/vc4/vc4_bo.c           |  4 ++--
 drivers/gpu/drm/vc4/vc4_gem.c          | 10 +++++-----
 drivers/gpu/drm/virtio/virtgpu_ioctl.c |  5 ++---
 6 files changed, 22 insertions(+), 21 deletions(-)

Comments

kernel test robot March 18, 2016, 5:39 p.m. UTC | #1
Hi Joe,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on next-20160318]
[cannot apply to v4.5]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Joe-Perches/gpu-drm-Use-u64_to_user_pointer/20160319-012749
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: m68k-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/vc4/vc4_bo.c: In function 'vc4_create_shader_bo_ioctl':
   drivers/gpu/drm/vc4/vc4_bo.c:502:2: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
     if (copy_from_user(bo->base.vaddr,
     ^
   In file included from arch/m68k/include/asm/uaccess.h:4:0,
                    from include/linux/uaccess.h:5,
                    from include/linux/highmem.h:8,
                    from include/drm/drmP.h:40,
                    from drivers/gpu/drm/vc4/vc4_drv.h:9,
                    from drivers/gpu/drm/vc4/vc4_bo.c:21:
>> arch/m68k/include/asm/uaccess_mm.h:368:2: warning: passing argument 2 of '__constant_copy_from_user' makes pointer from integer without a cast
     __constant_copy_from_user(to, from, n) : \
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_bo.c:502:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bo->base.vaddr,
         ^
   arch/m68k/include/asm/uaccess_mm.h:239:1: note: expected 'const void *' but argument is of type 'int'
    __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
    ^
>> arch/m68k/include/asm/uaccess_mm.h:369:2: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
     __generic_copy_from_user(to, from, n))
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_bo.c:502:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bo->base.vaddr,
         ^
   arch/m68k/include/asm/uaccess_mm.h:202:15: note: expected 'const void *' but argument is of type 'int'
    unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
                  ^
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_get_hang_state_ioctl':
   drivers/gpu/drm/vc4/vc4_gem.c:123:2: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
     ^
   In file included from arch/m68k/include/asm/uaccess.h:4:0,
                    from include/linux/uaccess.h:5,
                    from include/linux/highmem.h:8,
                    from include/drm/drmP.h:40,
                    from drivers/gpu/drm/vc4/vc4_drv.h:9,
                    from drivers/gpu/drm/vc4/vc4_gem.c:31:
>> arch/m68k/include/asm/uaccess_mm.h:373:2: warning: passing argument 1 of '__constant_copy_to_user' makes pointer from integer without a cast
     __constant_copy_to_user(to, from, n) :  \
     ^
>> arch/m68k/include/asm/uaccess_mm.h:380:35: note: in expansion of macro '__copy_to_user'
    #define copy_to_user(to, from, n) __copy_to_user(to, from, n)
                                      ^
   drivers/gpu/drm/vc4/vc4_gem.c:123:6: note: in expansion of macro 'copy_to_user'
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
         ^
   arch/m68k/include/asm/uaccess_mm.h:320:1: note: expected 'void *' but argument is of type 'int'
    __constant_copy_to_user(void __user *to, const void *from, unsigned long n)
    ^
>> arch/m68k/include/asm/uaccess_mm.h:374:2: warning: passing argument 1 of '__generic_copy_to_user' makes pointer from integer without a cast
     __generic_copy_to_user(to, from, n))
     ^
>> arch/m68k/include/asm/uaccess_mm.h:380:35: note: in expansion of macro '__copy_to_user'
    #define copy_to_user(to, from, n) __copy_to_user(to, from, n)
                                      ^
   drivers/gpu/drm/vc4/vc4_gem.c:123:6: note: in expansion of macro 'copy_to_user'
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
         ^
   arch/m68k/include/asm/uaccess_mm.h:203:15: note: expected 'void *' but argument is of type 'int'
    unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n);
                  ^
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_cl_lookup_bos':
>> arch/m68k/include/asm/uaccess_mm.h:368:2: warning: passing argument 2 of '__constant_copy_from_user' makes pointer from integer without a cast
     __constant_copy_from_user(to, from, n) : \
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:552:8: note: in expansion of macro 'copy_from_user'
     ret = copy_from_user(handles,
           ^
   arch/m68k/include/asm/uaccess_mm.h:239:1: note: expected 'const void *' but argument is of type 'int'
    __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
    ^
>> arch/m68k/include/asm/uaccess_mm.h:369:2: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
     __generic_copy_from_user(to, from, n))
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:552:8: note: in expansion of macro 'copy_from_user'
     ret = copy_from_user(handles,
           ^
   arch/m68k/include/asm/uaccess_mm.h:202:15: note: expected 'const void *' but argument is of type 'int'
    unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
                  ^
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_get_bcl':
>> arch/m68k/include/asm/uaccess_mm.h:368:2: warning: passing argument 2 of '__constant_copy_from_user' makes pointer from integer without a cast
     __constant_copy_from_user(to, from, n) : \
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:626:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bin,
         ^
   arch/m68k/include/asm/uaccess_mm.h:239:1: note: expected 'const void *' but argument is of type 'int'
    __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
    ^
>> arch/m68k/include/asm/uaccess_mm.h:369:2: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
     __generic_copy_from_user(to, from, n))
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:626:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bin,
         ^
   arch/m68k/include/asm/uaccess_mm.h:202:15: note: expected 'const void *' but argument is of type 'int'
    unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
                  ^
>> arch/m68k/include/asm/uaccess_mm.h:368:2: warning: passing argument 2 of '__constant_copy_from_user' makes pointer from integer without a cast
     __constant_copy_from_user(to, from, n) : \
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:633:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->shader_rec_u,
         ^
   arch/m68k/include/asm/uaccess_mm.h:239:1: note: expected 'const void *' but argument is of type 'int'
    __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
    ^
>> arch/m68k/include/asm/uaccess_mm.h:369:2: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
     __generic_copy_from_user(to, from, n))
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:633:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->shader_rec_u,
         ^
   arch/m68k/include/asm/uaccess_mm.h:202:15: note: expected 'const void *' but argument is of type 'int'
    unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
                  ^
>> arch/m68k/include/asm/uaccess_mm.h:368:2: warning: passing argument 2 of '__constant_copy_from_user' makes pointer from integer without a cast
     __constant_copy_from_user(to, from, n) : \
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:640:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->uniforms_u,
         ^
   arch/m68k/include/asm/uaccess_mm.h:239:1: note: expected 'const void *' but argument is of type 'int'
    __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
    ^
>> arch/m68k/include/asm/uaccess_mm.h:369:2: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
     __generic_copy_from_user(to, from, n))
     ^
>> arch/m68k/include/asm/uaccess_mm.h:379:37: note: in expansion of macro '__copy_from_user'
    #define copy_from_user(to, from, n) __copy_from_user(to, from, n)
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:640:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->uniforms_u,
         ^
   arch/m68k/include/asm/uaccess_mm.h:202:15: note: expected 'const void *' but argument is of type 'int'
    unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
                  ^
   cc1: some warnings being treated as errors

vim +/__constant_copy_from_user +368 arch/m68k/include/asm/uaccess_mm.h

^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  197  	}								\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  198  	__gu_err;							\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  199  })
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  200  #define get_user(x, ptr) __get_user(x, ptr)
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  201  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  202  unsigned long __generic_copy_from_user(void *to, const void __user *from, unsigned long n);
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23 @203  unsigned long __generic_copy_to_user(void __user *to, const void *from, unsigned long n);
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  204  
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  205  #define __constant_copy_from_user_asm(res, to, from, tmp, n, s1, s2, s3)\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  206  	asm volatile ("\n"						\
e08d703c arch/m68k/include/asm/uaccess_mm.h Greg Ungerer       2011-10-14  207  		"1:	"MOVES"."#s1"	(%2)+,%3\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  208  		"	move."#s1"	%3,(%1)+\n"			\
e08d703c arch/m68k/include/asm/uaccess_mm.h Greg Ungerer       2011-10-14  209  		"2:	"MOVES"."#s2"	(%2)+,%3\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  210  		"	move."#s2"	%3,(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  211  		"	.ifnc	\""#s3"\",\"\"\n"			\
e08d703c arch/m68k/include/asm/uaccess_mm.h Greg Ungerer       2011-10-14  212  		"3:	"MOVES"."#s3"	(%2)+,%3\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  213  		"	move."#s3"	%3,(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  214  		"	.endif\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  215  		"4:\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  216  		"	.section __ex_table,\"a\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  217  		"	.align	4\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  218  		"	.long	1b,10f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  219  		"	.long	2b,20f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  220  		"	.ifnc	\""#s3"\",\"\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  221  		"	.long	3b,30f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  222  		"	.endif\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  223  		"	.previous\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  224  		"\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  225  		"	.section .fixup,\"ax\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  226  		"	.even\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  227  		"10:	clr."#s1"	(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  228  		"20:	clr."#s2"	(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  229  		"	.ifnc	\""#s3"\",\"\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  230  		"30:	clr."#s3"	(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  231  		"	.endif\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  232  		"	moveq.l	#"#n",%0\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  233  		"	jra	4b\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  234  		"	.previous\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  235  		: "+d" (res), "+&a" (to), "+a" (from), "=&d" (tmp)	\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  236  		: : "memory")
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  237  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  238  static __always_inline unsigned long
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  239  __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  240  {
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  241  	unsigned long res = 0, tmp;
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  242  
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  243  	switch (n) {
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  244  	case 1:
b971018b include/asm-m68k/uaccess.h         Al Viro            2006-10-11  245  		__get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  246  		break;
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  247  	case 2:
631d8b67 arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2013-06-09  248  		__get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, r, 2);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  249  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  250  	case 3:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  251  		__constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  252  		break;
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  253  	case 4:
b971018b include/asm-m68k/uaccess.h         Al Viro            2006-10-11  254  		__get_user_asm(res, *(u32 *)to, (u32 __user *)from, u32, l, r, 4);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  255  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  256  	case 5:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  257  		__constant_copy_from_user_asm(res, to, from, tmp, 5, l, b,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  258  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  259  	case 6:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  260  		__constant_copy_from_user_asm(res, to, from, tmp, 6, l, w,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  261  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  262  	case 7:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  263  		__constant_copy_from_user_asm(res, to, from, tmp, 7, l, w, b);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  264  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  265  	case 8:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  266  		__constant_copy_from_user_asm(res, to, from, tmp, 8, l, l,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  267  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  268  	case 9:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  269  		__constant_copy_from_user_asm(res, to, from, tmp, 9, l, l, b);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  270  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  271  	case 10:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  272  		__constant_copy_from_user_asm(res, to, from, tmp, 10, l, l, w);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  273  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  274  	case 12:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  275  		__constant_copy_from_user_asm(res, to, from, tmp, 12, l, l, l);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  276  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  277  	default:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  278  		/* we limit the inlined version to 3 moves */
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  279  		return __generic_copy_from_user(to, from, n);
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  280  	}
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  281  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  282  	return res;
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  283  }
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  284  
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  285  #define __constant_copy_to_user_asm(res, to, from, tmp, n, s1, s2, s3)	\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  286  	asm volatile ("\n"						\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  287  		"	move."#s1"	(%2)+,%3\n"			\
e08d703c arch/m68k/include/asm/uaccess_mm.h Greg Ungerer       2011-10-14  288  		"11:	"MOVES"."#s1"	%3,(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  289  		"12:	move."#s2"	(%2)+,%3\n"			\
e08d703c arch/m68k/include/asm/uaccess_mm.h Greg Ungerer       2011-10-14  290  		"21:	"MOVES"."#s2"	%3,(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  291  		"22:\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  292  		"	.ifnc	\""#s3"\",\"\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  293  		"	move."#s3"	(%2)+,%3\n"			\
e08d703c arch/m68k/include/asm/uaccess_mm.h Greg Ungerer       2011-10-14  294  		"31:	"MOVES"."#s3"	%3,(%1)+\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  295  		"32:\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  296  		"	.endif\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  297  		"4:\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  298  		"\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  299  		"	.section __ex_table,\"a\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  300  		"	.align	4\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  301  		"	.long	11b,5f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  302  		"	.long	12b,5f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  303  		"	.long	21b,5f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  304  		"	.long	22b,5f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  305  		"	.ifnc	\""#s3"\",\"\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  306  		"	.long	31b,5f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  307  		"	.long	32b,5f\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  308  		"	.endif\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  309  		"	.previous\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  310  		"\n"							\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  311  		"	.section .fixup,\"ax\"\n"			\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  312  		"	.even\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  313  		"5:	moveq.l	#"#n",%0\n"				\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  314  		"	jra	4b\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  315  		"	.previous\n"					\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  316  		: "+d" (res), "+a" (to), "+a" (from), "=&d" (tmp)	\
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  317  		: : "memory")
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  318  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  319  static __always_inline unsigned long
11c40f8a include/asm-m68k/uaccess.h         Al Viro            2006-01-12  320  __constant_copy_to_user(void __user *to, const void *from, unsigned long n)
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  321  {
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  322  	unsigned long res = 0, tmp;
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  323  
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  324  	switch (n) {
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  325  	case 1:
b971018b include/asm-m68k/uaccess.h         Al Viro            2006-10-11  326  		__put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  327  		break;
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  328  	case 2:
631d8b67 arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2013-06-09  329  		__put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, r, 2);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  330  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  331  	case 3:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  332  		__constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  333  		break;
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  334  	case 4:
b971018b include/asm-m68k/uaccess.h         Al Viro            2006-10-11  335  		__put_user_asm(res, *(u32 *)from, (u32 __user *)to, l, r, 4);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  336  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  337  	case 5:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  338  		__constant_copy_to_user_asm(res, to, from, tmp, 5, l, b,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  339  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  340  	case 6:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  341  		__constant_copy_to_user_asm(res, to, from, tmp, 6, l, w,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  342  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  343  	case 7:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  344  		__constant_copy_to_user_asm(res, to, from, tmp, 7, l, w, b);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  345  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  346  	case 8:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  347  		__constant_copy_to_user_asm(res, to, from, tmp, 8, l, l,);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  348  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  349  	case 9:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  350  		__constant_copy_to_user_asm(res, to, from, tmp, 9, l, l, b);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  351  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  352  	case 10:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  353  		__constant_copy_to_user_asm(res, to, from, tmp, 10, l, l, w);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  354  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  355  	case 12:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  356  		__constant_copy_to_user_asm(res, to, from, tmp, 12, l, l, l);
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  357  		break;
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  358  	default:
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  359  		/* limit the inlined version to 3 moves */
53617825 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-25  360  		return __generic_copy_to_user(to, from, n);
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  361  	}
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  362  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  363  	return res;
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  364  }
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  365  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  366  #define __copy_from_user(to, from, n)		\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  367  (__builtin_constant_p(n) ?			\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16 @368   __constant_copy_from_user(to, from, n) :	\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16 @369   __generic_copy_from_user(to, from, n))
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  370  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  371  #define __copy_to_user(to, from, n)		\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  372  (__builtin_constant_p(n) ?			\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16 @373   __constant_copy_to_user(to, from, n) :		\
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16 @374   __generic_copy_to_user(to, from, n))
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  375  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  376  #define __copy_to_user_inatomic		__copy_to_user
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23  377  #define __copy_from_user_inatomic	__copy_from_user
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  378  
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23 @379  #define copy_from_user(to, from, n)	__copy_from_user(to, from, n)
d94af931 include/asm-m68k/uaccess.h         Roman Zippel       2006-06-23 @380  #define copy_to_user(to, from, n)	__copy_to_user(to, from, n)
^1da177e include/asm-m68k/uaccess.h         Linus Torvalds     2005-04-16  381  
d8ce7263 arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2012-05-29  382  #define user_addr_max() \
d8ce7263 arch/m68k/include/asm/uaccess_mm.h Geert Uytterhoeven 2012-05-29  383  	(segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL)

:::::: The code at line 368 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot March 18, 2016, 5:43 p.m. UTC | #2
Hi Joe,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on next-20160318]
[cannot apply to v4.5]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Joe-Perches/gpu-drm-Use-u64_to_user_pointer/20160319-012749
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: xtensa-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

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

   drivers/gpu/drm/vc4/vc4_bo.c: In function 'vc4_create_shader_bo_ioctl':
>> drivers/gpu/drm/vc4/vc4_bo.c:502:2: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
     if (copy_from_user(bo->base.vaddr,
     ^
   In file included from include/linux/uaccess.h:5:0,
                    from include/linux/highmem.h:8,
                    from include/drm/drmP.h:40,
                    from drivers/gpu/drm/vc4/vc4_drv.h:9,
                    from drivers/gpu/drm/vc4/vc4_bo.c:21:
>> arch/xtensa/include/asm/uaccess.h:429:37: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
    #define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
                                        ^
>> drivers/gpu/drm/vc4/vc4_bo.c:502:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bo->base.vaddr,
         ^
   arch/xtensa/include/asm/uaccess.h:418:1: note: expected 'const void *' but argument is of type 'int'
    __generic_copy_from_user(void *to, const void *from, unsigned long n)
    ^
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_get_hang_state_ioctl':
>> drivers/gpu/drm/vc4/vc4_gem.c:123:2: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
     ^
   In file included from include/linux/uaccess.h:5:0,
                    from include/linux/highmem.h:8,
                    from include/drm/drmP.h:40,
                    from drivers/gpu/drm/vc4/vc4_drv.h:9,
                    from drivers/gpu/drm/vc4/vc4_gem.c:31:
>> arch/xtensa/include/asm/uaccess.h:428:35: warning: passing argument 1 of '__generic_copy_to_user' makes pointer from integer without a cast
    #define copy_to_user(to, from, n) __generic_copy_to_user((to), (from), (n))
                                      ^
>> drivers/gpu/drm/vc4/vc4_gem.c:123:6: note: in expansion of macro 'copy_to_user'
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
         ^
   arch/xtensa/include/asm/uaccess.h:409:1: note: expected 'void *' but argument is of type 'int'
    __generic_copy_to_user(void *to, const void *from, unsigned long n)
    ^
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_cl_lookup_bos':
>> arch/xtensa/include/asm/uaccess.h:429:37: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
    #define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
                                        ^
>> drivers/gpu/drm/vc4/vc4_gem.c:552:8: note: in expansion of macro 'copy_from_user'
     ret = copy_from_user(handles,
           ^
   arch/xtensa/include/asm/uaccess.h:418:1: note: expected 'const void *' but argument is of type 'int'
    __generic_copy_from_user(void *to, const void *from, unsigned long n)
    ^
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_get_bcl':
>> arch/xtensa/include/asm/uaccess.h:429:37: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
    #define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:626:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bin,
         ^
   arch/xtensa/include/asm/uaccess.h:418:1: note: expected 'const void *' but argument is of type 'int'
    __generic_copy_from_user(void *to, const void *from, unsigned long n)
    ^
>> arch/xtensa/include/asm/uaccess.h:429:37: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
    #define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:633:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->shader_rec_u,
         ^
   arch/xtensa/include/asm/uaccess.h:418:1: note: expected 'const void *' but argument is of type 'int'
    __generic_copy_from_user(void *to, const void *from, unsigned long n)
    ^
>> arch/xtensa/include/asm/uaccess.h:429:37: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
    #define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
                                        ^
   drivers/gpu/drm/vc4/vc4_gem.c:640:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->uniforms_u,
         ^
   arch/xtensa/include/asm/uaccess.h:418:1: note: expected 'const void *' but argument is of type 'int'
    __generic_copy_from_user(void *to, const void *from, unsigned long n)
    ^
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/virtio/virtgpu_ioctl.c: In function 'virtio_gpu_execbuffer':
>> drivers/gpu/drm/virtio/virtgpu_ioctl.c:126:3: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
      user_bo_handles = u64_to_user_ptr(exbuf->bo_handles);
      ^
>> drivers/gpu/drm/virtio/virtgpu_ioctl.c:126:19: warning: assignment makes pointer from integer without a cast
      user_bo_handles = u64_to_user_ptr(exbuf->bo_handles);
                      ^
   In file included from include/linux/uaccess.h:5:0,
                    from include/linux/highmem.h:8,
                    from include/drm/drmP.h:40,
                    from drivers/gpu/drm/virtio/virtgpu_ioctl.c:28:
>> arch/xtensa/include/asm/uaccess.h:429:37: warning: passing argument 2 of '__generic_copy_from_user' makes pointer from integer without a cast
    #define copy_from_user(to, from, n) __generic_copy_from_user((to), (from), (n))
                                        ^
>> drivers/gpu/drm/virtio/virtgpu_ioctl.c:161:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(buf, u64_to_user_ptr(exbuf->command), exbuf->size)) {
         ^
   arch/xtensa/include/asm/uaccess.h:418:1: note: expected 'const void *' but argument is of type 'int'
    __generic_copy_from_user(void *to, const void *from, unsigned long n)
    ^
   cc1: some warnings being treated as errors

vim +/u64_to_user_ptr +502 drivers/gpu/drm/vc4/vc4_bo.c

463873d5 Eric Anholt   2015-11-30  496  	}
463873d5 Eric Anholt   2015-11-30  497  
463873d5 Eric Anholt   2015-11-30  498  	bo = vc4_bo_create(dev, args->size, true);
2c68f1fc Eric Anholt   2016-01-25  499  	if (IS_ERR(bo))
2c68f1fc Eric Anholt   2016-01-25  500  		return PTR_ERR(bo);
463873d5 Eric Anholt   2015-11-30  501  
585cb132 Dan Carpenter 2016-03-08 @502  	if (copy_from_user(bo->base.vaddr,
3f3044e5 Joe Perches   2016-03-18  503  			   u64_to_user_ptr(args->data),
585cb132 Dan Carpenter 2016-03-08  504  			   args->size)) {
585cb132 Dan Carpenter 2016-03-08  505  		ret = -EFAULT;

:::::: The code at line 502 was first introduced by commit
:::::: 585cb132a48190b554aecda2ebc3e2911fcbb665 drm/vc4: Return -EFAULT on copy_from_user() failure

:::::: TO: Dan Carpenter <dan.carpenter@oracle.com>
:::::: CC: Eric Anholt <eric@anholt.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Joe Perches March 18, 2016, 5:43 p.m. UTC | #3
On Sat, 2016-03-19 at 01:39 +0800, kbuild test robot wrote:
> Hi Joe,
> 
> [auto build test WARNING on drm/drm-next]
> [also build test WARNING on next-20160318]
> [cannot apply to v4.5]
> [if your patch is applied to the wrong git tree, please drop us a
> note to help improving the system]

Thanks, but this depends on Gustavo's patches too.
kernel test robot March 18, 2016, 5:46 p.m. UTC | #4
Hi Joe,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on next-20160318]
[cannot apply to v4.5]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Joe-Perches/gpu-drm-Use-u64_to_user_pointer/20160319-012749
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: mips-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   In file included from include/linux/uaccess.h:5:0,
                    from include/linux/highmem.h:8,
                    from include/drm/drmP.h:40,
                    from drivers/gpu/drm/vc4/vc4_drv.h:9,
                    from drivers/gpu/drm/vc4/vc4_bo.c:21:
   drivers/gpu/drm/vc4/vc4_bo.c: In function 'vc4_create_shader_bo_ioctl':
   drivers/gpu/drm/vc4/vc4_bo.c:503:7: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
          u64_to_user_ptr(args->data),
          ^
   arch/mips/include/asm/uaccess.h:1161:15: note: in definition of macro 'copy_from_user'
     __cu_from = (from);      \
                  ^
>> arch/mips/include/asm/uaccess.h:1161:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     __cu_from = (from);      \
               ^
   drivers/gpu/drm/vc4/vc4_bo.c:502:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bo->base.vaddr,
         ^
   cc1: some warnings being treated as errors
--
   In file included from arch/mips/include/asm/module.h:6:0,
                    from include/linux/module.h:24,
                    from drivers/gpu/drm/vc4/vc4_gem.c:24:
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_get_hang_state_ioctl':
   drivers/gpu/drm/vc4/vc4_gem.c:123:19: error: implicit declaration of function 'u64_to_user_ptr' [-Werror=implicit-function-declaration]
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
                      ^
   arch/mips/include/asm/uaccess.h:930:13: note: in definition of macro 'copy_to_user'
     __cu_to = (to);       \
                ^
   arch/mips/include/asm/uaccess.h:930:10: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     __cu_to = (to);       \
             ^
   drivers/gpu/drm/vc4/vc4_gem.c:123:6: note: in expansion of macro 'copy_to_user'
     if (copy_to_user(u64_to_user_ptr(get_state->bo),
         ^
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_cl_lookup_bos':
>> arch/mips/include/asm/uaccess.h:1161:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     __cu_from = (from);      \
               ^
   drivers/gpu/drm/vc4/vc4_gem.c:552:8: note: in expansion of macro 'copy_from_user'
     ret = copy_from_user(handles,
           ^
   drivers/gpu/drm/vc4/vc4_gem.c: In function 'vc4_get_bcl':
>> arch/mips/include/asm/uaccess.h:1161:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     __cu_from = (from);      \
               ^
   drivers/gpu/drm/vc4/vc4_gem.c:626:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(bin,
         ^
>> arch/mips/include/asm/uaccess.h:1161:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     __cu_from = (from);      \
               ^
   drivers/gpu/drm/vc4/vc4_gem.c:633:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->shader_rec_u,
         ^
>> arch/mips/include/asm/uaccess.h:1161:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     __cu_from = (from);      \
               ^
   drivers/gpu/drm/vc4/vc4_gem.c:640:6: note: in expansion of macro 'copy_from_user'
     if (copy_from_user(exec->uniforms_u,
         ^
   cc1: some warnings being treated as errors

vim +1161 arch/mips/include/asm/uaccess.h

^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1145   *
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1146   * Copy data from user space to kernel space.
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1147   *
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1148   * Returns number of bytes that could not be copied.
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1149   * On success, this will be zero.
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1150   *
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1151   * If some data could not be copied, this function will pad the copied
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1152   * data to the requested size using zero bytes.
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1153   */
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1154  #define copy_from_user(to, from, n)					\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1155  ({									\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1156  	void *__cu_to;							\
fe00f943 include/asm-mips/uaccess.h      Ralf Baechle    2005-03-01  1157  	const void __user *__cu_from;					\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1158  	long __cu_len;							\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1159  									\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1160  	__cu_to = (to);							\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16 @1161  	__cu_from = (from);						\
^1da177e include/asm-mips/uaccess.h      Linus Torvalds  2005-04-16  1162  	__cu_len = (n);							\
12060666 arch/mips/include/asm/uaccess.h Paul Burton     2015-05-24  1163  	if (eva_kernel_access()) {					\
05c65160 arch/mips/include/asm/uaccess.h Markos Chandras 2013-12-11  1164  		__cu_len = __invoke_copy_from_kernel(__cu_to,		\
05c65160 arch/mips/include/asm/uaccess.h Markos Chandras 2013-12-11  1165  						     __cu_from,		\
05c65160 arch/mips/include/asm/uaccess.h Markos Chandras 2013-12-11  1166  						     __cu_len);		\
05c65160 arch/mips/include/asm/uaccess.h Markos Chandras 2013-12-11  1167  	} else {							\
ef41f460 arch/mips/include/asm/uaccess.h Ralf Baechle    2009-04-28  1168  		if (access_ok(VERIFY_READ, __cu_from, __cu_len)) {	\
ef41f460 arch/mips/include/asm/uaccess.h Ralf Baechle    2009-04-28  1169  			might_fault();                                  \

:::::: The code at line 1161 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index 6e731db..7629dd2 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -382,7 +382,7 @@  int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
 	if (args->size == 0)
 		return 0;
 
-	ptr = (char __user *)(uintptr_t)args->ptr;
+	ptr = u64_to_user_ptr(args->ptr);
 
 	if (!access_ok(VERIFY_READ, ptr, args->size))
 		return -EFAULT;
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
index a0865c4..1a6604c9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -467,11 +467,12 @@  validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli,
 	      uint64_t user_pbbo_ptr)
 {
 	struct nouveau_drm *drm = chan->drm;
-	struct drm_nouveau_gem_pushbuf_bo __user *upbbo =
-				(void __force __user *)(uintptr_t)user_pbbo_ptr;
+	struct drm_nouveau_gem_pushbuf_bo __user *upbbo;
 	struct nouveau_bo *nvbo;
 	int ret, relocs = 0;
 
+	upbbo = u64_to_user_ptr(user_pbbo_ptr);
+
 	list_for_each_entry(nvbo, list, entry) {
 		struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index];
 
@@ -565,7 +566,7 @@  static inline void *
 u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
 {
 	void *mem;
-	void __user *userptr = (void __force __user *)(uintptr_t)user;
+	void __user *userptr = u64_to_user_ptr(user);
 
 	size *= nmemb;
 
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 8e6b18c..b20c87d 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -329,12 +329,9 @@  int tegra_drm_submit(struct tegra_drm_context *context,
 	unsigned int num_cmdbufs = args->num_cmdbufs;
 	unsigned int num_relocs = args->num_relocs;
 	unsigned int num_waitchks = args->num_waitchks;
-	struct drm_tegra_cmdbuf __user *cmdbufs =
-		(void __user *)(uintptr_t)args->cmdbufs;
-	struct drm_tegra_reloc __user *relocs =
-		(void __user *)(uintptr_t)args->relocs;
-	struct drm_tegra_waitchk __user *waitchks =
-		(void __user *)(uintptr_t)args->waitchks;
+	struct drm_tegra_cmdbuf __user *cmdbufs;
+	struct drm_tegra_reloc __user *relocs;
+	struct drm_tegra_waitchk __user *waitchks;
 	struct drm_tegra_syncpt syncpt;
 	struct host1x_job *job;
 	int err;
@@ -354,6 +351,10 @@  int tegra_drm_submit(struct tegra_drm_context *context,
 	job->class = context->client->base.class;
 	job->serialize = true;
 
+	cmdbufs = u64_to_user_ptr(args->cmdbufs);
+	relocs = u64_to_user_ptr(args->relocs);
+	waitchks = u64_to_user_ptr(args->waitchks);
+
 	while (num_cmdbufs) {
 		struct drm_tegra_cmdbuf cmdbuf;
 		struct host1x_bo *bo;
@@ -389,7 +390,7 @@  int tegra_drm_submit(struct tegra_drm_context *context,
 		goto fail;
 	}
 
-	if (copy_from_user(&syncpt, (void __user *)(uintptr_t)args->syncpts,
+	if (copy_from_user(&syncpt, u64_to_user_ptr(args->syncpts),
 			   sizeof(syncpt))) {
 		err = -EFAULT;
 		goto fail;
diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 9807bc9..fe3a4aa 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -499,8 +499,8 @@  vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
 		return PTR_ERR(bo);
 
 	if (copy_from_user(bo->base.vaddr,
-			     (void __user *)(uintptr_t)args->data,
-			     args->size)) {
+			   u64_to_user_ptr(args->data),
+			   args->size)) {
 		ret = -EFAULT;
 		goto fail;
 	}
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 8d4384f..89d7931 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -120,7 +120,7 @@  vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
 		bo_state[i].size = vc4_bo->base.base.size;
 	}
 
-	if (copy_to_user((void __user *)(uintptr_t)get_state->bo,
+	if (copy_to_user(u64_to_user_ptr(get_state->bo),
 			 bo_state,
 			 state->bo_count * sizeof(*bo_state)))
 		ret = -EFAULT;
@@ -550,7 +550,7 @@  vc4_cl_lookup_bos(struct drm_device *dev,
 	}
 
 	ret = copy_from_user(handles,
-			     (void __user *)(uintptr_t)args->bo_handles,
+			     u64_to_user_ptr(args->bo_handles),
 			     exec->bo_count * sizeof(uint32_t));
 	if (ret) {
 		DRM_ERROR("Failed to copy in GEM handles\n");
@@ -624,21 +624,21 @@  vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)
 	exec->shader_state_size = args->shader_rec_count;
 
 	if (copy_from_user(bin,
-			   (void __user *)(uintptr_t)args->bin_cl,
+			   u64_to_user_ptr(args->bin_cl),
 			   args->bin_cl_size)) {
 		ret = -EFAULT;
 		goto fail;
 	}
 
 	if (copy_from_user(exec->shader_rec_u,
-			   (void __user *)(uintptr_t)args->shader_rec,
+			   u64_to_user_ptr(args->shader_rec),
 			   args->shader_rec_size)) {
 		ret = -EFAULT;
 		goto fail;
 	}
 
 	if (copy_from_user(exec->uniforms_u,
-			   (void __user *)(uintptr_t)args->uniforms,
+			   u64_to_user_ptr(args->uniforms),
 			   args->uniforms_size)) {
 		ret = -EFAULT;
 		goto fail;
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index b4de18e..e602bb6 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -123,7 +123,7 @@  static int virtio_gpu_execbuffer(struct drm_device *dev,
 			return -ENOMEM;
 		}
 
-		user_bo_handles = (void __user *)(uintptr_t)exbuf->bo_handles;
+		user_bo_handles = u64_to_user_ptr(exbuf->bo_handles);
 		if (copy_from_user(bo_handles, user_bo_handles,
 				   exbuf->num_bo_handles * sizeof(uint32_t))) {
 			ret = -EFAULT;
@@ -158,8 +158,7 @@  static int virtio_gpu_execbuffer(struct drm_device *dev,
 		ret = -ENOMEM;
 		goto out_unresv;
 	}
-	if (copy_from_user(buf, (void __user *)(uintptr_t)exbuf->command,
-			   exbuf->size)) {
+	if (copy_from_user(buf, u64_to_user_ptr(exbuf->command), exbuf->size)) {
 		kfree(buf);
 		ret = -EFAULT;
 		goto out_unresv;