[vfs:work.__copy_to_user 1/1] drivers/gpu/drm/drm_dp_aux_dev.c:152:2: error: implicit declaration of function 'iov_iter_truncate'

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.__copy_to_user
head:   4aeedce7fd39ff708dc022e03a7db275e0d3f81c
commit: 4aeedce7fd39ff708dc022e03a7db275e0d3f81c [1/1] drm_dp_aux_dev: switch to read_iter/write_iter
config: x86_64-randconfig-x019-201728 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 4aeedce7fd39ff708dc022e03a7db275e0d3f81c
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

   drivers/gpu/drm/drm_dp_aux_dev.c: In function 'auxdev_read_iter':
>> drivers/gpu/drm/drm_dp_aux_dev.c:152:2: error: implicit declaration of function 'iov_iter_truncate' [-Werror=implicit-function-declaration]
     iov_iter_truncate(to, AUX_MAX_OFFSET - pos);
     ^~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_dp_aux_dev.c:154:9: error: implicit declaration of function 'iov_iter_count' [-Werror=implicit-function-declaration]
     while (iov_iter_count(to)) {
            ^~~~~~~~~~~~~~
   In file included from include/linux/list.h:8:0,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from drivers/gpu/drm/drm_dp_aux_dev.c:28:
   include/linux/kernel.h:757:16: warning: comparison of distinct pointer types lacks a cast
     (void) (&min1 == &min2);   \
                   ^
   include/linux/kernel.h:760:2: note: in expansion of macro '__min'
     __min(typeof(x), typeof(y),   \
     ^~~~~
>> drivers/gpu/drm/drm_dp_aux_dev.c:156:18: note: in expansion of macro 'min'
      ssize_t todo = min(iov_iter_count(to), sizeof(buf));
                     ^~~
>> drivers/gpu/drm/drm_dp_aux_dev.c:167:7: error: implicit declaration of function 'copy_to_iter' [-Werror=implicit-function-declaration]
      if (copy_to_iter(buf, res, to) != res) {
          ^~~~~~~~~~~~
   In file included from include/linux/list.h:8:0,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from drivers/gpu/drm/drm_dp_aux_dev.c:28:
   drivers/gpu/drm/drm_dp_aux_dev.c: In function 'auxdev_write_iter':
   include/linux/kernel.h:757:16: warning: comparison of distinct pointer types lacks a cast
     (void) (&min1 == &min2);   \
                   ^
   include/linux/kernel.h:760:2: note: in expansion of macro '__min'
     __min(typeof(x), typeof(y),   \
     ^~~~~
   drivers/gpu/drm/drm_dp_aux_dev.c:197:18: note: in expansion of macro 'min'
      ssize_t todo = min(iov_iter_count(from), sizeof(buf));
                     ^~~
>> drivers/gpu/drm/drm_dp_aux_dev.c:204:8: error: implicit declaration of function 'copy_from_iter_full' [-Werror=implicit-function-declaration]
      if (!copy_from_iter_full(buf, todo, from)) {
           ^~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/drm_dp_aux_dev.c:209:42: error: 'offset' undeclared (first use in this function)
      res = drm_dp_dpcd_write(aux_dev->aux, *offset, localbuf, todo);
                                             ^~~~~~
   drivers/gpu/drm/drm_dp_aux_dev.c:209:42: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/drm_dp_aux_dev.c:209:50: error: 'localbuf' undeclared (first use in this function)
      res = drm_dp_dpcd_write(aux_dev->aux, *offset, localbuf, todo);
                                                     ^~~~~~~~
   cc1: some warnings being treated as errors

vim +/iov_iter_truncate +152 drivers/gpu/drm/drm_dp_aux_dev.c

    22	 *
    23	 * Authors:
    24	 *    Rafael Antognolli <rafael.antognolli@xxxxxxxxx>
    25	 *
    26	 */
    27	
  > 28	#include <linux/device.h>
    29	#include <linux/fs.h>
    30	#include <linux/slab.h>
    31	#include <linux/init.h>
    32	#include <linux/kernel.h>
    33	#include <linux/module.h>
    34	#include <linux/uaccess.h>
    35	#include <drm/drm_dp_helper.h>
    36	#include <drm/drm_crtc.h>
    37	#include <drm/drmP.h>
    38	
    39	#include "drm_crtc_helper_internal.h"
    40	
    41	struct drm_dp_aux_dev {
    42		unsigned index;
    43		struct drm_dp_aux *aux;
    44		struct device *dev;
    45		struct kref refcount;
    46		atomic_t usecount;
    47	};
    48	
    49	#define DRM_AUX_MINORS	256
    50	#define AUX_MAX_OFFSET	(1 << 20)
    51	static DEFINE_IDR(aux_idr);
    52	static DEFINE_MUTEX(aux_idr_mutex);
    53	static struct class *drm_dp_aux_dev_class;
    54	static int drm_dev_major = -1;
    55	
    56	static struct drm_dp_aux_dev *drm_dp_aux_dev_get_by_minor(unsigned index)
    57	{
    58		struct drm_dp_aux_dev *aux_dev = NULL;
    59	
    60		mutex_lock(&aux_idr_mutex);
    61		aux_dev = idr_find(&aux_idr, index);
    62		if (!kref_get_unless_zero(&aux_dev->refcount))
    63			aux_dev = NULL;
    64		mutex_unlock(&aux_idr_mutex);
    65	
    66		return aux_dev;
    67	}
    68	
    69	static struct drm_dp_aux_dev *alloc_drm_dp_aux_dev(struct drm_dp_aux *aux)
    70	{
    71		struct drm_dp_aux_dev *aux_dev;
    72		int index;
    73	
    74		aux_dev = kzalloc(sizeof(*aux_dev), GFP_KERNEL);
    75		if (!aux_dev)
    76			return ERR_PTR(-ENOMEM);
    77		aux_dev->aux = aux;
    78		atomic_set(&aux_dev->usecount, 1);
    79		kref_init(&aux_dev->refcount);
    80	
    81		mutex_lock(&aux_idr_mutex);
    82		index = idr_alloc_cyclic(&aux_idr, aux_dev, 0, DRM_AUX_MINORS,
    83					 GFP_KERNEL);
    84		mutex_unlock(&aux_idr_mutex);
    85		if (index < 0) {
    86			kfree(aux_dev);
    87			return ERR_PTR(index);
    88		}
    89		aux_dev->index = index;
    90	
    91		return aux_dev;
    92	}
    93	
    94	static void release_drm_dp_aux_dev(struct kref *ref)
    95	{
    96		struct drm_dp_aux_dev *aux_dev =
    97			container_of(ref, struct drm_dp_aux_dev, refcount);
    98	
    99		kfree(aux_dev);
   100	}
   101	
   102	static ssize_t name_show(struct device *dev,
   103				 struct device_attribute *attr, char *buf)
   104	{
   105		ssize_t res;
   106		struct drm_dp_aux_dev *aux_dev =
   107			drm_dp_aux_dev_get_by_minor(MINOR(dev->devt));
   108	
   109		if (!aux_dev)
   110			return -ENODEV;
   111	
   112		res = sprintf(buf, "%s\n", aux_dev->aux->name);
   113		kref_put(&aux_dev->refcount, release_drm_dp_aux_dev);
   114	
   115		return res;
   116	}
   117	static DEVICE_ATTR_RO(name);
   118	
   119	static struct attribute *drm_dp_aux_attrs[] = {
   120		&dev_attr_name.attr,
   121		NULL,
   122	};
   123	ATTRIBUTE_GROUPS(drm_dp_aux);
   124	
   125	static int auxdev_open(struct inode *inode, struct file *file)
   126	{
   127		unsigned int minor = iminor(inode);
   128		struct drm_dp_aux_dev *aux_dev;
   129	
   130		aux_dev = drm_dp_aux_dev_get_by_minor(minor);
   131		if (!aux_dev)
   132			return -ENODEV;
   133	
   134		file->private_data = aux_dev;
   135		return 0;
   136	}
   137	
   138	static loff_t auxdev_llseek(struct file *file, loff_t offset, int whence)
   139	{
   140		return fixed_size_llseek(file, offset, whence, AUX_MAX_OFFSET);
   141	}
   142	
   143	static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
   144	{
   145		struct drm_dp_aux_dev *aux_dev = iocb->ki_filp->private_data;
   146		loff_t pos = iocb->ki_pos;
   147		ssize_t res = 0;
   148	
   149		if (!atomic_inc_not_zero(&aux_dev->usecount))
   150			return -ENODEV;
   151	
 > 152		iov_iter_truncate(to, AUX_MAX_OFFSET - pos);
   153	
 > 154		while (iov_iter_count(to)) {
   155			uint8_t buf[DP_AUX_MAX_PAYLOAD_BYTES];
 > 156			ssize_t todo = min(iov_iter_count(to), sizeof(buf));
   157	
   158			if (signal_pending(current)) {
   159				res = -ERESTARTSYS;
   160				break;
   161			}
   162	
   163			res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
   164			if (res <= 0)
   165				break;
   166	
 > 167			if (copy_to_iter(buf, res, to) != res) {
   168				res = -EFAULT;
   169				break;
   170			}
   171	
   172			pos += res;
   173		}
   174	
   175		if (pos != iocb->ki_pos)
   176			res = pos - iocb->ki_pos;
   177		iocb->ki_pos = pos;
   178	
   179		atomic_dec(&aux_dev->usecount);
   180		wake_up_atomic_t(&aux_dev->usecount);
   181		return res;
   182	}
   183	
   184	static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
   185	{
   186		struct drm_dp_aux_dev *aux_dev = iocb->ki_filp->private_data;
   187		loff_t pos = iocb->ki_pos;
   188		ssize_t res = 0;
   189	
   190		if (!atomic_inc_not_zero(&aux_dev->usecount))
   191			return -ENODEV;
   192	
   193		iov_iter_truncate(from, AUX_MAX_OFFSET - pos);
   194	
   195		while (iov_iter_count(from)) {
   196			uint8_t buf[DP_AUX_MAX_PAYLOAD_BYTES];
 > 197			ssize_t todo = min(iov_iter_count(from), sizeof(buf));
   198	
   199			if (signal_pending(current)) {
   200				res = -ERESTARTSYS;
   201				break;
   202			}
   203	
 > 204			if (!copy_from_iter_full(buf, todo, from)) {
   205				res = -EFAULT;
   206				break;
   207			}
   208	
 > 209			res = drm_dp_dpcd_write(aux_dev->aux, *offset, localbuf, todo);
   210			if (res <= 0)
   211				break;
   212	

---
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 Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux