Re: [PATCH] media: v4l2-compat-ioctl32: fix several __user annotations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mauro,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.16 next-20180413]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/media-v4l2-compat-ioctl32-fix-several-__user-annotations/20180414-001705
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x006-201814 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

   In file included from include/linux/uaccess.h:14:0,
                    from include/linux/compat.h:20,
                    from drivers/media/v4l2-core/v4l2-compat-ioctl32.c:16:
   drivers/media/v4l2-core/v4l2-compat-ioctl32.c: In function 'put_v4l2_buffer32':
>> arch/x86/include/asm/uaccess.h:181:6: error: void value not ignored as it ought to be
     (x) = (__force __typeof__(*(ptr))) __val_gu;   \
         ^
>> drivers/media/v4l2-core/v4l2-compat-ioctl32.c:619:7: note: in expansion of macro 'get_user'
      if (get_user(uplane, (__force void __user *)&kp->m.planes))
          ^~~~~~~~
--
   In file included from include/linux/uaccess.h:14:0,
                    from include/linux/compat.h:20,
                    from drivers/media//v4l2-core/v4l2-compat-ioctl32.c:16:
   drivers/media//v4l2-core/v4l2-compat-ioctl32.c: In function 'put_v4l2_buffer32':
>> arch/x86/include/asm/uaccess.h:181:6: error: void value not ignored as it ought to be
     (x) = (__force __typeof__(*(ptr))) __val_gu;   \
         ^
   drivers/media//v4l2-core/v4l2-compat-ioctl32.c:619:7: note: in expansion of macro 'get_user'
      if (get_user(uplane, (__force void __user *)&kp->m.planes))
          ^~~~~~~~

vim +/get_user +619 drivers/media/v4l2-core/v4l2-compat-ioctl32.c

   580	
   581	static int put_v4l2_buffer32(struct v4l2_buffer __user *kp,
   582				     struct v4l2_buffer32 __user *up)
   583	{
   584		u32 type;
   585		u32 length;
   586		enum v4l2_memory memory;
   587		struct v4l2_plane32 __user *uplane32;
   588		struct v4l2_plane *uplane;
   589		compat_caddr_t p;
   590		int ret;
   591	
   592		if (!access_ok(VERIFY_WRITE, up, sizeof(*up)) ||
   593		    assign_in_user(&up->index, &kp->index) ||
   594		    get_user(type, &kp->type) ||
   595		    put_user(type, &up->type) ||
   596		    assign_in_user(&up->flags, &kp->flags) ||
   597		    get_user(memory, &kp->memory) ||
   598		    put_user(memory, &up->memory))
   599			return -EFAULT;
   600	
   601		if (assign_in_user(&up->bytesused, &kp->bytesused) ||
   602		    assign_in_user(&up->field, &kp->field) ||
   603		    assign_in_user(&up->timestamp.tv_sec, &kp->timestamp.tv_sec) ||
   604		    assign_in_user(&up->timestamp.tv_usec, &kp->timestamp.tv_usec) ||
   605		    copy_in_user(&up->timecode, &kp->timecode, sizeof(kp->timecode)) ||
   606		    assign_in_user(&up->sequence, &kp->sequence) ||
   607		    assign_in_user(&up->reserved2, &kp->reserved2) ||
   608		    assign_in_user(&up->reserved, &kp->reserved) ||
   609		    get_user(length, &kp->length) ||
   610		    put_user(length, &up->length))
   611			return -EFAULT;
   612	
   613		if (V4L2_TYPE_IS_MULTIPLANAR(type)) {
   614			u32 num_planes = length;
   615	
   616			if (num_planes == 0)
   617				return 0;
   618	
 > 619			if (get_user(uplane, (__force void __user *)&kp->m.planes))
   620				return -EFAULT;
   621			if (get_user(p, &up->m.planes))
   622				return -EFAULT;
   623			uplane32 = compat_ptr(p);
   624	
   625			while (num_planes--) {
   626				ret = put_v4l2_plane32((void __user *)uplane,
   627						       uplane32, memory);
   628				if (ret)
   629					return ret;
   630				++uplane;
   631				++uplane32;
   632			}
   633		} else {
   634			switch (memory) {
   635			case V4L2_MEMORY_MMAP:
   636			case V4L2_MEMORY_OVERLAY:
   637				if (assign_in_user(&up->m.offset, &kp->m.offset))
   638					return -EFAULT;
   639				break;
   640			case V4L2_MEMORY_USERPTR:
   641				if (assign_in_user(&up->m.userptr, &kp->m.userptr))
   642					return -EFAULT;
   643				break;
   644			case V4L2_MEMORY_DMABUF:
   645				if (assign_in_user(&up->m.fd, &kp->m.fd))
   646					return -EFAULT;
   647				break;
   648			}
   649		}
   650	
   651		return 0;
   652	}
   653	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux