[vfs:work.misc 23/24] drivers/usb/core/devio.c:162:48: note: in expansion of macro 'MAX_LFS_FILESIZE'

[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.misc
head:   c252565e251d06c63bfa12df7cb9129bbbdaeed3
commit: 5367cc1a0c0cd39ffbbba10b60153cfbcc8b764d [23/24] new helper: no_seek_end_llseek()
config: i386-randconfig-s0-201549 (attached as .config)
reproduce:
        git checkout 5367cc1a0c0cd39ffbbba10b60153cfbcc8b764d
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from drivers/usb/core/devio.c:37:0:
   drivers/usb/core/devio.c: In function 'usbdev_lseek':
   include/linux/fs.h:898:36: error: 'PAGE_CACHE_SIZE' undeclared (first use in this function)
    #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
                                       ^
>> drivers/usb/core/devio.c:162:48: note: in expansion of macro 'MAX_LFS_FILESIZE'
     return no_seek_end_llseek(file, offset, orig, MAX_LFS_FILESIZE);
                                                   ^
   include/linux/fs.h:898:36: note: each undeclared identifier is reported only once for each function it appears in
    #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
                                       ^
>> drivers/usb/core/devio.c:162:48: note: in expansion of macro 'MAX_LFS_FILESIZE'
     return no_seek_end_llseek(file, offset, orig, MAX_LFS_FILESIZE);
                                                   ^
>> drivers/usb/core/devio.c:163:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^
--
   In file included from drivers/usb/core/devices.c:52:0:
   drivers/usb/core/devices.c: In function 'usb_device_lseek':
   include/linux/fs.h:898:36: error: 'PAGE_CACHE_SIZE' undeclared (first use in this function)
    #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
                                       ^
>> drivers/usb/core/devices.c:666:48: note: in expansion of macro 'MAX_LFS_FILESIZE'
     return no_seek_end_llseek(file, offset, orig, MAX_LFS_FILESIZE);
                                                   ^
   include/linux/fs.h:898:36: note: each undeclared identifier is reported only once for each function it appears in
    #define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 
                                       ^
>> drivers/usb/core/devices.c:666:48: note: in expansion of macro 'MAX_LFS_FILESIZE'
     return no_seek_end_llseek(file, offset, orig, MAX_LFS_FILESIZE);
                                                   ^
>> drivers/usb/core/devices.c:667:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

vim +/MAX_LFS_FILESIZE +162 drivers/usb/core/devio.c

    31	 *    30.09.2005   0.3   Fix user-triggerable oops in async URB delivery
    32	 *    			 (CAN-2005-3055)
    33	 */
    34	
    35	/*****************************************************************************/
    36	
  > 37	#include <linux/fs.h>
    38	#include <linux/mm.h>
    39	#include <linux/slab.h>
    40	#include <linux/signal.h>
    41	#include <linux/poll.h>
    42	#include <linux/module.h>
    43	#include <linux/string.h>
    44	#include <linux/usb.h>
    45	#include <linux/usbdevice_fs.h>
    46	#include <linux/usb/hcd.h>	/* for usbcore internals */
    47	#include <linux/cdev.h>
    48	#include <linux/notifier.h>
    49	#include <linux/security.h>
    50	#include <linux/user_namespace.h>
    51	#include <linux/scatterlist.h>
    52	#include <linux/uaccess.h>
    53	#include <asm/byteorder.h>
    54	#include <linux/moduleparam.h>
    55	
    56	#include "usb.h"
    57	
    58	#define USB_MAXBUS			64
    59	#define USB_DEVICE_MAX			(USB_MAXBUS * 128)
    60	#define USB_SG_SIZE			16384 /* split-size for large txs */
    61	
    62	/* Mutual exclusion for removal, open, and release */
    63	DEFINE_MUTEX(usbfs_mutex);
    64	
    65	struct usb_dev_state {
    66		struct list_head list;      /* state list */
    67		struct usb_device *dev;
    68		struct file *file;
    69		spinlock_t lock;            /* protects the async urb lists */
    70		struct list_head async_pending;
    71		struct list_head async_completed;
    72		wait_queue_head_t wait;     /* wake up if a request completed */
    73		unsigned int discsignr;
    74		struct pid *disc_pid;
    75		const struct cred *cred;
    76		void __user *disccontext;
    77		unsigned long ifclaimed;
    78		u32 secid;
    79		u32 disabled_bulk_eps;
    80	};
    81	
    82	struct async {
    83		struct list_head asynclist;
    84		struct usb_dev_state *ps;
    85		struct pid *pid;
    86		const struct cred *cred;
    87		unsigned int signr;
    88		unsigned int ifnum;
    89		void __user *userbuffer;
    90		void __user *userurb;
    91		struct urb *urb;
    92		unsigned int mem_usage;
    93		int status;
    94		u32 secid;
    95		u8 bulk_addr;
    96		u8 bulk_status;
    97	};
    98	
    99	static bool usbfs_snoop;
   100	module_param(usbfs_snoop, bool, S_IRUGO | S_IWUSR);
   101	MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs traffic");
   102	
   103	#define snoop(dev, format, arg...)				\
   104		do {							\
   105			if (usbfs_snoop)				\
   106				dev_info(dev, format, ## arg);		\
   107		} while (0)
   108	
   109	enum snoop_when {
   110		SUBMIT, COMPLETE
   111	};
   112	
   113	#define USB_DEVICE_DEV		MKDEV(USB_DEVICE_MAJOR, 0)
   114	
   115	/* Limit on the total amount of memory we can allocate for transfers */
   116	static unsigned usbfs_memory_mb = 16;
   117	module_param(usbfs_memory_mb, uint, 0644);
   118	MODULE_PARM_DESC(usbfs_memory_mb,
   119			"maximum MB allowed for usbfs buffers (0 = no limit)");
   120	
   121	/* Hard limit, necessary to avoid arithmetic overflow */
   122	#define USBFS_XFER_MAX		(UINT_MAX / 2 - 1000000)
   123	
   124	static atomic_t usbfs_memory_usage;	/* Total memory currently allocated */
   125	
   126	/* Check whether it's okay to allocate more memory for a transfer */
   127	static int usbfs_increase_memory_usage(unsigned amount)
   128	{
   129		unsigned lim;
   130	
   131		/*
   132		 * Convert usbfs_memory_mb to bytes, avoiding overflows.
   133		 * 0 means use the hard limit (effectively unlimited).
   134		 */
   135		lim = ACCESS_ONCE(usbfs_memory_mb);
   136		if (lim == 0 || lim > (USBFS_XFER_MAX >> 20))
   137			lim = USBFS_XFER_MAX;
   138		else
   139			lim <<= 20;
   140	
   141		atomic_add(amount, &usbfs_memory_usage);
   142		if (atomic_read(&usbfs_memory_usage) <= lim)
   143			return 0;
   144		atomic_sub(amount, &usbfs_memory_usage);
   145		return -ENOMEM;
   146	}
   147	
   148	/* Memory for a transfer is being deallocated */
   149	static void usbfs_decrease_memory_usage(unsigned amount)
   150	{
   151		atomic_sub(amount, &usbfs_memory_usage);
   152	}
   153	
   154	static int connected(struct usb_dev_state *ps)
   155	{
   156		return (!list_empty(&ps->list) &&
   157				ps->dev->state != USB_STATE_NOTATTACHED);
   158	}
   159	
   160	static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
   161	{
 > 162		return no_seek_end_llseek(file, offset, orig, MAX_LFS_FILESIZE);
 > 163	}
   164	
   165	static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes,
   166				   loff_t *ppos)

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

Attachment: .config.gz
Description: Binary data


[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