Commit f9280acd authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: vlan annotation

parent eb3119f9
...@@ -55,7 +55,7 @@ struct vlan_hdr { ...@@ -55,7 +55,7 @@ struct vlan_hdr {
#define VLAN_VID_MASK 0xfff #define VLAN_VID_MASK 0xfff
/* found in socket.c */ /* found in socket.c */
extern void vlan_ioctl_set(int (*hook)(unsigned long)); extern void vlan_ioctl_set(int (*hook)(void __user *));
#define VLAN_NAME "vlan" #define VLAN_NAME "vlan"
......
...@@ -49,7 +49,7 @@ static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; ...@@ -49,7 +49,7 @@ static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
static int vlan_device_event(struct notifier_block *, unsigned long, void *); static int vlan_device_event(struct notifier_block *, unsigned long, void *);
static int vlan_ioctl_handler(unsigned long); static int vlan_ioctl_handler(void __user *);
static int unregister_vlan_dev(struct net_device *, unsigned short ); static int unregister_vlan_dev(struct net_device *, unsigned short );
struct notifier_block vlan_notifier_block = { struct notifier_block vlan_notifier_block = {
...@@ -661,9 +661,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, ...@@ -661,9 +661,9 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
/* /*
* VLAN IOCTL handler. * VLAN IOCTL handler.
* o execute requested action or pass command to the device driver * o execute requested action or pass command to the device driver
* arg is really a void* to a vlan_ioctl_args structure. * arg is really a struct vlan_ioctl_args __user *.
*/ */
static int vlan_ioctl_handler(unsigned long arg) static int vlan_ioctl_handler(void __user *arg)
{ {
int err = 0; int err = 0;
struct vlan_ioctl_args args; struct vlan_ioctl_args args;
...@@ -675,8 +675,7 @@ static int vlan_ioctl_handler(unsigned long arg) ...@@ -675,8 +675,7 @@ static int vlan_ioctl_handler(unsigned long arg)
if (!capable(CAP_NET_ADMIN)) if (!capable(CAP_NET_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user(&args, (void*)arg, if (copy_from_user(&args, arg, sizeof(struct vlan_ioctl_args)))
sizeof(struct vlan_ioctl_args)))
return -EFAULT; return -EFAULT;
/* Null terminate this sucker, just in case. */ /* Null terminate this sucker, just in case. */
......
...@@ -740,9 +740,9 @@ void brioctl_set(int (*hook)(unsigned int, void __user *)) ...@@ -740,9 +740,9 @@ void brioctl_set(int (*hook)(unsigned int, void __user *))
EXPORT_SYMBOL(brioctl_set); EXPORT_SYMBOL(brioctl_set);
static DECLARE_MUTEX(vlan_ioctl_mutex); static DECLARE_MUTEX(vlan_ioctl_mutex);
static int (*vlan_ioctl_hook)(unsigned long arg); static int (*vlan_ioctl_hook)(void __user *arg);
void vlan_ioctl_set(int (*hook)(unsigned long)) void vlan_ioctl_set(int (*hook)(void __user *))
{ {
down(&vlan_ioctl_mutex); down(&vlan_ioctl_mutex);
vlan_ioctl_hook = hook; vlan_ioctl_hook = hook;
...@@ -816,7 +816,7 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -816,7 +816,7 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
down(&vlan_ioctl_mutex); down(&vlan_ioctl_mutex);
if (vlan_ioctl_hook) if (vlan_ioctl_hook)
err = vlan_ioctl_hook(arg); err = vlan_ioctl_hook(argp);
up(&vlan_ioctl_mutex); up(&vlan_ioctl_mutex);
break; break;
case SIOCGIFDIVERT: case SIOCGIFDIVERT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment