Re: [PATCH 3/3] media: dvb_frontend: Add commands implementation for compat ioct

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

 



Hi Jaedon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.15-rc2 next-20171204]
[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/Jaedon-Shin/Add-support-compat-in-dvb_frontend-c/20171204-201817
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-ne0-12042359 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/media/dvb-core/dvb_frontend.c:1992:4: error: unknown type name 'compat_uptr_t'
       compat_uptr_t reserved2;
       ^~~~~~~~~~~~~
   drivers/media/dvb-core/dvb_frontend.c:2000:2: error: unknown type name 'compat_uptr_t'
     compat_uptr_t props;
     ^~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c: In function 'dvb_frontend_handle_compat_ioctl':
   drivers/media/dvb-core/dvb_frontend.c:2018:29: error: implicit declaration of function 'compat_ptr' [-Werror=implicit-function-declaration]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/dvb-core/dvb_frontend.c:2018:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   drivers/media/dvb-core/dvb_frontend.c:2018:29: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/dvb-core/dvb_frontend.c:2018:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   In file included from include/linux/poll.h:12:0,
                    from drivers/media/dvb-core/dvb_frontend.c:35:
   include/linux/uaccess.h:144:1: note: expected 'const void *' but argument is of type 'int'
    copy_from_user(void *to, const void __user *from, unsigned long n)
    ^~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c:2018:29: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/media/dvb-core/dvb_frontend.c:2018:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   In file included from include/linux/poll.h:12:0,
                    from drivers/media/dvb-core/dvb_frontend.c:35:
   include/linux/uaccess.h:144:1: note: expected 'const void *' but argument is of type 'int'
    copy_from_user(void *to, const void __user *from, unsigned long n)
    ^~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c:2018:29: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/media/dvb-core/dvb_frontend.c:2018:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   In file included from include/linux/poll.h:12:0,
                    from drivers/media/dvb-core/dvb_frontend.c:35:
   include/linux/uaccess.h:144:1: note: expected 'const void *' but argument is of type 'int'
    copy_from_user(void *to, const void __user *from, unsigned long n)
    ^~~~~~~~~~~~~~
   drivers/media/dvb-core/dvb_frontend.c:2030:21: warning: passing argument 1 of 'memdup_user' makes pointer from integer without a cast [-Wint-conversion]
      tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp));
                        ^~~~~~~~~~
   In file included from drivers/media/dvb-core/dvb_frontend.c:30:0:
   include/linux/string.h:13:14: note: expected 'const void *' but argument is of type 'int'
    extern void *memdup_user(const void __user *, size_t);
                 ^~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c:2049:29: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   drivers/media/dvb-core/dvb_frontend.c:2049:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   In file included from include/linux/poll.h:12:0,
                    from drivers/media/dvb-core/dvb_frontend.c:35:
   include/linux/uaccess.h:144:1: note: expected 'const void *' but argument is of type 'int'
    copy_from_user(void *to, const void __user *from, unsigned long n)
    ^~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c:2049:29: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   drivers/media/dvb-core/dvb_frontend.c:2049:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   In file included from include/linux/poll.h:12:0,
                    from drivers/media/dvb-core/dvb_frontend.c:35:
   include/linux/uaccess.h:144:1: note: expected 'const void *' but argument is of type 'int'
    copy_from_user(void *to, const void __user *from, unsigned long n)
    ^~~~~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c:2049:29: warning: passing argument 2 of 'copy_from_user' makes pointer from integer without a cast [-Wint-conversion]
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
                                ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   drivers/media/dvb-core/dvb_frontend.c:2049:3: note: in expansion of macro 'if'
      if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
      ^~
   In file included from include/linux/poll.h:12:0,
                    from drivers/media/dvb-core/dvb_frontend.c:35:
   include/linux/uaccess.h:144:1: note: expected 'const void *' but argument is of type 'int'
    copy_from_user(void *to, const void __user *from, unsigned long n)
    ^~~~~~~~~~~~~~
   drivers/media/dvb-core/dvb_frontend.c:2061:21: warning: passing argument 1 of 'memdup_user' makes pointer from integer without a cast [-Wint-conversion]
      tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp));
                        ^~~~~~~~~~
   In file included from drivers/media/dvb-core/dvb_frontend.c:30:0:
   include/linux/string.h:13:14: note: expected 'const void *' but argument is of type 'int'
    extern void *memdup_user(const void __user *, size_t);
                 ^~~~~~~~~~~
   In file included from include/linux/string.h:6:0,
                    from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c:2087:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
                       ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   drivers/media/dvb-core/dvb_frontend.c:2087:3: note: in expansion of macro 'if'
      if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
      ^~
   drivers/media/dvb-core/dvb_frontend.c:2087:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
                       ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   drivers/media/dvb-core/dvb_frontend.c:2087:3: note: in expansion of macro 'if'
      if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
      ^~
   drivers/media/dvb-core/dvb_frontend.c:2087:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
                       ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   drivers/media/dvb-core/dvb_frontend.c:2087:3: note: in expansion of macro 'if'
      if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
      ^~
   drivers/media/dvb-core/dvb_frontend.c: At top level:
   include/linux/compiler.h:64:4: warning: '______f' is static but declared in inline function 'strcpy' which is not static

vim +/if +2018 drivers/media/dvb-core/dvb_frontend.c

  2005	
  2006	static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd,
  2007						    unsigned long arg)
  2008	{
  2009		struct dvb_device *dvbdev = file->private_data;
  2010		struct dvb_frontend *fe = dvbdev->priv;
  2011		struct dvb_frontend_private *fepriv = fe->frontend_priv;
  2012		int i, err = 0;
  2013	
  2014		if (cmd == COMPAT_FE_SET_PROPERTY) {
  2015			struct compat_dtv_properties prop, *tvps = NULL;
  2016			struct compat_dtv_property *tvp = NULL;
  2017	
> 2018			if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
  2019				return -EFAULT;
  2020	
  2021			tvps = ∝
  2022	
  2023			/*
  2024			 * Put an arbitrary limit on the number of messages that can
  2025			 * be sent at once
  2026			 */
  2027			if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS))
  2028				return -EINVAL;
  2029	
  2030			tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp));
  2031			if (IS_ERR(tvp))
  2032				return PTR_ERR(tvp);
  2033	
  2034			for (i = 0; i < tvps->num; i++) {
  2035				err = dtv_property_process_set(fe, file,
  2036								(tvp + i)->cmd,
  2037								(tvp + i)->u.data);
  2038				if (err < 0) {
  2039					kfree(tvp);
  2040					return err;
  2041				}
  2042			}
  2043			kfree(tvp);
  2044		} else if (cmd == COMPAT_FE_GET_PROPERTY) {
  2045			struct compat_dtv_properties prop, *tvps = NULL;
  2046			struct compat_dtv_property *tvp = NULL;
  2047			struct dtv_frontend_properties getp = fe->dtv_property_cache;
  2048	
  2049			if (copy_from_user(&prop, compat_ptr(arg), sizeof(prop)))
  2050				return -EFAULT;
  2051	
  2052			tvps = &prop;
  2053	
  2054			/*
  2055			 * Put an arbitrary limit on the number of messages that can
  2056			 * be sent at once
  2057			 */
  2058			if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS))
  2059				return -EINVAL;
  2060	
  2061			tvp = memdup_user(compat_ptr(tvps->props), tvps->num * sizeof(*tvp));
  2062			if (IS_ERR(tvp))
  2063				return PTR_ERR(tvp);
  2064	
  2065			/*
  2066			 * Let's use our own copy of property cache, in order to
  2067			 * avoid mangling with DTV zigzag logic, as drivers might
  2068			 * return crap, if they don't check if the data is available
  2069			 * before updating the properties cache.
  2070			 */
  2071			if (fepriv->state != FESTATE_IDLE) {
  2072				err = dtv_get_frontend(fe, &getp, NULL);
  2073				if (err < 0) {
  2074					kfree(tvp);
  2075					return err;
  2076				}
  2077			}
  2078			for (i = 0; i < tvps->num; i++) {
  2079				err = dtv_property_process_get(
  2080				    fe, &getp, (struct dtv_property *)tvp + i, file);
  2081				if (err < 0) {
  2082					kfree(tvp);
  2083					return err;
  2084				}
  2085			}
  2086	
  2087			if (copy_to_user((void __user *)compat_ptr(tvps->props), tvp,
  2088					 tvps->num * sizeof(struct compat_dtv_property))) {
  2089				kfree(tvp);
  2090				return -EFAULT;
  2091			}
  2092			kfree(tvp);
  2093		}
  2094	
  2095		return err;
  2096	}
  2097	

---
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