]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sparse: atm annotation (core)
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Thu, 3 Jun 2004 14:02:43 +0000 (07:02 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 3 Jun 2004 14:02:43 +0000 (07:02 -0700)
ATM core annotated; ATM drivers will go in the next patch, here we only
annotated their method prototypes

17 files changed:
include/linux/atm.h
include/linux/atmdev.h
net/atm/addr.c
net/atm/addr.h
net/atm/br2684.c
net/atm/common.c
net/atm/common.h
net/atm/ioctl.c
net/atm/lec.c
net/atm/lec.h
net/atm/mpc.c
net/atm/mpc.h
net/atm/mpoa_proc.c
net/atm/pppoatm.c
net/atm/proc.c
net/atm/resources.c
net/atm/resources.h

index 0380156f9c86e780b641a8ebae96363ef4069447..04e9170695c570722b9d9d1f4e528f8fefcf85e7 100644 (file)
@@ -232,7 +232,7 @@ static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
 struct atmif_sioc {
     int number;
     int length;
-    void *arg;
+    void __user *arg;
 };
 
 typedef unsigned short atm_backend_t;
index 9242c9c3142ecab67e824ac02a4165deb02c086c..b19303d3fa6b2e098e7e5a5c4859410629c37a75 100644 (file)
@@ -351,11 +351,11 @@ struct atmdev_ops { /* only send is required */
        void (*dev_close)(struct atm_dev *dev);
        int (*open)(struct atm_vcc *vcc);
        void (*close)(struct atm_vcc *vcc);
-       int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);
+       int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
        int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
-           void *optval,int optlen);
+           void __user *optval,int optlen);
        int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
-           void *optval,int optlen);
+           void __user *optval,int optlen);
        int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
        int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
        void (*phy_put)(struct atm_dev *dev,unsigned char value,
@@ -368,7 +368,7 @@ struct atmdev_ops { /* only send is required */
 
 struct atmphy_ops {
        int (*start)(struct atm_dev *dev);
-       int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);
+       int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
        void (*interrupt)(struct atm_dev *dev);
        int (*stop)(struct atm_dev *dev);
 };
index 459bdeed05f9e3573cc38bdef9b22afd82ff558c..96407a0bb609ba39d7ffa4044f36e65ae82e6b65 100644 (file)
@@ -114,7 +114,7 @@ int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr)
 }
 
 
-int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
+int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,int size)
 {
        unsigned long flags;
        struct atm_dev_addr *walk;
@@ -134,7 +134,7 @@ int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
                memcpy(tmp_bufp++, &walk->addr, sizeof(struct sockaddr_atmsvc));
        spin_unlock_irqrestore(&dev->lock, flags);
        error = total > size ? -E2BIG : total;
-       if (copy_to_user(u_buf, tmp_buf, total < size ? total : size))
+       if (copy_to_user(buf, tmp_buf, total < size ? total : size))
                error = -EFAULT;
        kfree(tmp_buf);
        return error;
index 89f651cbc78d7ce73e5182ce77361304e551a929..2affa3a128cab97b86fd77cc8b4ae12075b15f0e 100644 (file)
@@ -13,6 +13,6 @@
 void atm_reset_addr(struct atm_dev *dev);
 int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr);
 int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr);
-int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size);
+int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc __user *buf,int size);
 
 #endif
index f469813faff8b4506fd00ba4402f42fa0e11676c..91a89d3a24f2d136ade222bfe26833acd2bae566 100644 (file)
@@ -342,12 +342,12 @@ static int br2684_mac_addr(struct net_device *dev, void *p)
 
 #ifdef CONFIG_ATM_BR2684_IPFILTER
 /* this IOCTL is experimental. */
-static int br2684_setfilt(struct atm_vcc *atmvcc, unsigned long arg)
+static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg)
 {
        struct br2684_vcc *brvcc;
        struct br2684_filter_set fs;
 
-       if (copy_from_user(&fs, (void *) arg, sizeof fs))
+       if (copy_from_user(&fs, arg, sizeof fs))
                return -EFAULT;
        if (fs.ifspec.method != BR2684_FIND_BYNOTHING) {
                /*
@@ -494,7 +494,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
        netif_rx(skb);
 }
 
-static int br2684_regvcc(struct atm_vcc *atmvcc, unsigned long arg)
+static int br2684_regvcc(struct atm_vcc *atmvcc, void __user *arg)
 {
 /* assign a vcc to a dev
 Note: we do not have explicit unassign, but look at _push()
@@ -507,7 +507,7 @@ Note: we do not have explicit unassign, but look at _push()
        struct net_device *net_dev;
        struct atm_backend_br2684 be;
 
-       if (copy_from_user(&be, (void *) arg, sizeof be))
+       if (copy_from_user(&be, arg, sizeof be))
                return -EFAULT;
        brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
        if (!brvcc)
@@ -593,7 +593,7 @@ static void br2684_setup(struct net_device *netdev)
        INIT_LIST_HEAD(&brdev->brvccs);
 }
 
-static int br2684_create(unsigned long arg)
+static int br2684_create(void __user *arg)
 {
        int err;
        struct net_device *netdev;
@@ -602,7 +602,7 @@ static int br2684_create(unsigned long arg)
 
        DPRINTK("br2684_create\n");
 
-       if (copy_from_user(&ni, (void *) arg, sizeof ni)) {
+       if (copy_from_user(&ni, arg, sizeof ni)) {
                return -EFAULT;
        }
        if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) {
@@ -642,13 +642,14 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd,
        unsigned long arg)
 {
        struct atm_vcc *atmvcc = ATM_SD(sock);
+       void __user *argp = (void __user *)arg;
 
        int err;
        switch(cmd) {
        case ATM_SETBACKEND:
        case ATM_NEWBACKENDIF: {
                atm_backend_t b;
-               err = get_user(b, (atm_backend_t *) arg);
+               err = get_user(b, (atm_backend_t __user *) argp);
                if (err)
                        return -EFAULT;
                if (b != ATM_BACKEND_BR2684)
@@ -656,9 +657,9 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd,
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
                if (cmd == ATM_SETBACKEND)
-                       return br2684_regvcc(atmvcc, arg);
+                       return br2684_regvcc(atmvcc, argp);
                else
-                       return br2684_create(arg);
+                       return br2684_create(argp);
                }
 #ifdef CONFIG_ATM_BR2684_IPFILTER
        case BR2684_SETFILT:
@@ -666,7 +667,7 @@ static int br2684_ioctl(struct socket *sock, unsigned int cmd,
                        return -ENOIOCTLCMD;
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
-               err = br2684_setfilt(atmvcc, arg);
+               err = br2684_setfilt(atmvcc, argp);
                return err;
 #endif /* CONFIG_ATM_BR2684_IPFILTER */
        }
index 859b727395d7022f770da0356f2d25651115cb9d..ce00ea644c758ad8bad5532c47de4aa1228aace4 100644 (file)
@@ -509,7 +509,7 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
        struct atm_vcc *vcc;
        struct sk_buff *skb;
        int eff,error;
-       const void *buff;
+       const void __user *buff;
        int size;
 
        lock_sock(sk);
@@ -676,7 +676,7 @@ static int check_qos(struct atm_qos *qos)
 }
 
 int vcc_setsockopt(struct socket *sock, int level, int optname,
-                  char *optval, int optlen)
+                  char __user *optval, int optlen)
 {
        struct atm_vcc *vcc;
        unsigned long value;
@@ -704,7 +704,7 @@ int vcc_setsockopt(struct socket *sock, int level, int optname,
                                return 0;
                        }
                case SO_SETCLP:
-                       if (get_user(value,(unsigned long *) optval))
+                       if (get_user(value,(unsigned long __user *)optval))
                                return -EFAULT;
                        if (value) vcc->atm_options |= ATM_ATMOPT_CLP;
                        else vcc->atm_options &= ~ATM_ATMOPT_CLP;
@@ -719,7 +719,7 @@ int vcc_setsockopt(struct socket *sock, int level, int optname,
 
 
 int vcc_getsockopt(struct socket *sock, int level, int optname,
-                  char *optval, int *optlen)
+                  char __user *optval, int __user *optlen)
 {
        struct atm_vcc *vcc;
        int len;
@@ -738,7 +738,7 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,
                            -EFAULT : 0;
                case SO_SETCLP:
                        return put_user(vcc->atm_options & ATM_ATMOPT_CLP ? 1 :
-                         0,(unsigned long *) optval) ? -EFAULT : 0;
+                         0,(unsigned long __user *)optval) ? -EFAULT : 0;
                case SO_ATMPVC:
                        {
                                struct sockaddr_atmpvc pvc;
index fe634abeb457d299e4f1e9d968649d29e642dd97..d4cb95c57e820c117f9ade398f794fa9a10756c9 100644 (file)
@@ -19,10 +19,10 @@ int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m,
                size_t total_len);
 unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait);
 int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
-int vcc_setsockopt(struct socket *sock, int level, int optname, char *optval,
-                  int optlen);
-int vcc_getsockopt(struct socket *sock, int level, int optname, char *optval,
-                  int *optlen);
+int vcc_setsockopt(struct socket *sock, int level, int optname,
+                  char __user *optval, int optlen);
+int vcc_getsockopt(struct socket *sock, int level, int optname,
+                  char __user *optval, int __user *optlen);
 
 void atm_shutdown_dev(struct atm_dev *dev);
 
index a2d9cd23d2274ad3b8513d17243de2fafafd50fb..b15e724f8f96f5cf21a866fc73044f9b847e223a 100644 (file)
@@ -49,6 +49,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
        struct atm_vcc *vcc;
        int error;
        struct list_head * pos;
+       void __user *argp = (void __user *)arg;
 
        vcc = ATM_SD(sock);
        switch (cmd) {
@@ -60,7 +61,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        }
                        error = put_user(vcc->sk->sk_sndbuf -
                                         atomic_read(&vcc->sk->sk_wmem_alloc),
-                                        (int *) arg) ? -EFAULT : 0;
+                                        (int __user *) argp) ? -EFAULT : 0;
                        goto done;
                case SIOCINQ:
                        {
@@ -72,12 +73,11 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                                }
                                skb = skb_peek(&vcc->sk->sk_receive_queue);
                                error = put_user(skb ? skb->len : 0,
-                                                (int *) arg) ? -EFAULT : 0;
+                                                (int __user *)argp) ? -EFAULT : 0;
                                goto done;
                        }
                case SIOCGSTAMP: /* borrowed from IP */
-                       error = sock_get_timestamp(vcc->sk,
-                                       (struct timeval __user *) arg);
+                       error = sock_get_timestamp(vcc->sk, argp);
                        goto done;
                case ATM_SETSC:
                        printk(KERN_WARNING "ATM_SETSC is obsolete\n");
@@ -131,7 +131,7 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
        if (error != -ENOIOCTLCMD)
                goto done;
 
-       error = atm_dev_ioctl(cmd, arg);
+       error = atm_dev_ioctl(cmd, argp);
 
 done:
        return error;
index fb6cc84bb7cdaf65777741f820cc9ec25dd27ed2..b005e1a5c3ae178bd22892679cc23eee8a3eeb86 100644 (file)
@@ -774,7 +774,7 @@ lec_pop(struct atm_vcc *vcc, struct sk_buff *skb)
 }
 
 int 
-lec_vcc_attach(struct atm_vcc *vcc, void *arg)
+lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
 {
        struct lec_vcc_priv *vpriv;
         int bytes_left;
@@ -1161,7 +1161,7 @@ static int lane_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                        err = lec_mcast_attach(vcc, (int) arg);
                        break;
                case ATMLEC_DATA:
-                       err = lec_vcc_attach(vcc, (void *) arg);
+                       err = lec_vcc_attach(vcc, (void __user *) arg);
                        break;
        }
 
index 673bd7881318964cb7ca702fd3b8557a1f198f79..af655919368627078c29f4171a5f92e7400df885 100644 (file)
@@ -148,7 +148,7 @@ struct lec_vcc_priv {
 #define LEC_VCC_PRIV(vcc)      ((struct lec_vcc_priv *)((vcc)->user_back))
 
 int lecd_attach(struct atm_vcc *vcc, int arg);
-int lec_vcc_attach(struct atm_vcc *vcc, void *arg);
+int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg);
 int lec_mcast_attach(struct atm_vcc *vcc, int arg);
 struct net_device *get_dev_lec(int itf);
 int make_lec(struct atm_vcc *vcc);
index 0ca118478c9d24bf3ee7b00c84f1622547ed58ca..e629e89d4df41dc3c5762ec23043b827f3dfe00b 100644 (file)
@@ -565,7 +565,7 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
        return retval;
 }
 
-int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg)
+int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
 {
        int bytes_left;
        struct mpoa_client *mpc;
@@ -574,7 +574,7 @@ int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg)
        uint32_t  ipaddr;
        unsigned char *ip;
 
-       bytes_left = copy_from_user(&ioc_data, (void *)arg, sizeof(struct atmmpc_ioc));
+       bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmmpc_ioc));
        if (bytes_left != 0) {
                printk("mpoa: mpc_vcc_attach: Short read (missed %d bytes) from userland\n", bytes_left);
                return -EFAULT;
@@ -1366,7 +1366,7 @@ static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action)
        return;
 }
 
-static void mpc_timer_refresh()
+static void mpc_timer_refresh(void)
 {
        mpc_timer.expires = jiffies + (MPC_P2 * HZ);
        mpc_timer.data = mpc_timer.expires;
@@ -1418,7 +1418,7 @@ static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd, unsigned long a
                                sock->state = SS_CONNECTED;
                        break;
                case ATMMPC_DATA:
-                       err = atm_mpoa_vcc_attach(vcc, arg);
+                       err = atm_mpoa_vcc_attach(vcc, (void __user *)arg);
                        break;
                default:
                        break;
index a28e4b2749605505f7df68f90c851e1b27b0bf84..c7b1108d01e4e7e1179ced05d5762f0f8e086eca 100644 (file)
@@ -13,7 +13,7 @@ int msg_to_mpoad(struct k_message *msg, struct mpoa_client *mpc);
 
 /* Functions for ioctl(ATMMPC_*) operations */
 int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg);
-int atm_mpoa_vcc_attach(struct atm_vcc *vcc, long arg);
+int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg);
 
 struct mpoa_client {
         struct mpoa_client *next;
index 6201756e61da264330ba4194b927baa2e776aae5..64c676dd550eeb865517387a3f31bebf3e461156 100644 (file)
 extern struct mpoa_client *mpcs;
 extern struct proc_dir_entry *atm_proc_root;  /* from proc.c. */
 
-static ssize_t proc_mpc_read(struct file *file, char *buff,
+static ssize_t proc_mpc_read(struct file *file, char __user *buff,
                             size_t count, loff_t *pos);
 
-static ssize_t proc_mpc_write(struct file *file, const char *buff,
+static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
                               size_t nbytes, loff_t *ppos);
 
 static int parse_qos(const char *buff, int len);
@@ -99,7 +99,7 @@ static const char *egress_state_string(int state){
 /*
  * READING function - called when the /proc/atm/mpoa file is read from.
  */
-static ssize_t proc_mpc_read(struct file *file, char *buff,
+static ssize_t proc_mpc_read(struct file *file, char __user *buff,
                             size_t count, loff_t *pos){
         unsigned long page = 0;
        unsigned char *temp;
@@ -165,12 +165,12 @@ static ssize_t proc_mpc_read(struct file *file, char *buff,
         return length;
 }
 
-static ssize_t proc_mpc_write(struct file *file, const char *buff,
+static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
                               size_t nbytes, loff_t *ppos)
 {
         int incoming, error, retval;
         char *page, c;
-        const char *tmp;
+        const char __user *tmp;
 
         if (nbytes == 0) return 0;
         if (nbytes >= PAGE_SIZE) nbytes = PAGE_SIZE-1;
index 95b63a08e40ce7ef1fc55b4ad5b3b444c425c635..e430c24ccfdad4d1cdad6cb4584d81cab14181e4 100644 (file)
@@ -257,10 +257,10 @@ static int pppoatm_devppp_ioctl(struct ppp_channel *chan, unsigned int cmd,
 {
        switch (cmd) {
        case PPPIOCGFLAGS:
-               return put_user(chan_to_pvcc(chan)->flags, (int *) arg)
+               return put_user(chan_to_pvcc(chan)->flags, (int __user *) arg)
                    ? -EFAULT : 0;
        case PPPIOCSFLAGS:
-               return get_user(chan_to_pvcc(chan)->flags, (int *) arg)
+               return get_user(chan_to_pvcc(chan)->flags, (int __user *) arg)
                    ? -EFAULT : 0;
        }
        return -ENOTTY;
@@ -271,7 +271,7 @@ static /*const*/ struct ppp_channel_ops pppoatm_ops = {
        .ioctl = pppoatm_devppp_ioctl,
 };
 
-static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg)
+static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
 {
        struct atm_backend_ppp be;
        struct pppoatm_vcc *pvcc;
@@ -281,7 +281,7 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, unsigned long arg)
         * prototypical one used to initialize them
         */
        static const DECLARE_TASKLET(tasklet_proto, pppoatm_wakeup_sender, 0);
-       if (copy_from_user(&be, (void *) arg, sizeof be))
+       if (copy_from_user(&be, arg, sizeof be))
                return -EFAULT;
        if (be.encaps != PPPOATM_ENCAPS_AUTODETECT &&
            be.encaps != PPPOATM_ENCAPS_VC && be.encaps != PPPOATM_ENCAPS_LLC)
@@ -319,26 +319,27 @@ static int pppoatm_ioctl(struct socket *sock, unsigned int cmd,
        unsigned long arg)
 {
        struct atm_vcc *atmvcc = ATM_SD(sock);
+       void __user *argp = (void __user *)arg;
 
        if (cmd != ATM_SETBACKEND && atmvcc->push != pppoatm_push)
                return -ENOIOCTLCMD;
        switch (cmd) {
        case ATM_SETBACKEND: {
                atm_backend_t b;
-               if (get_user(b, (atm_backend_t *) arg))
+               if (get_user(b, (atm_backend_t __user *) argp))
                        return -EFAULT;
                if (b != ATM_BACKEND_PPP)
                        return -ENOIOCTLCMD;
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
-               return pppoatm_assign_vcc(atmvcc, arg);
+               return pppoatm_assign_vcc(atmvcc, argp);
                }
        case PPPIOCGCHAN:
                return put_user(ppp_channel_index(&atmvcc_to_pvcc(atmvcc)->
-                   chan), (int *) arg) ? -EFAULT : 0;
+                   chan), (int __user *) argp) ? -EFAULT : 0;
        case PPPIOCGUNIT:
                return put_user(ppp_unit_number(&atmvcc_to_pvcc(atmvcc)->
-                   chan), (int *) arg) ? -EFAULT : 0;
+                   chan), (int __user *) argp) ? -EFAULT : 0;
        }
        return -ENOIOCTLCMD;
 }
index fffc39bc1395734e1b088f428b4737153a270f19..12f49fe94c8f3c3358afed2b75d064933ab1501b 100644 (file)
@@ -31,7 +31,7 @@
 #include "common.h" /* atm_proc_init prototype */
 #include "signaling.h" /* to get sigd - ugly too */
 
-static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count,
+static ssize_t proc_dev_atm_read(struct file *file,char __user *buf,size_t count,
     loff_t *pos);
 
 static struct file_operations proc_atm_dev_ops = {
@@ -384,8 +384,8 @@ static struct file_operations svc_seq_fops = {
        .release        = vcc_seq_release,
 };
 
-static ssize_t proc_dev_atm_read(struct file *file,char *buf,size_t count,
-    loff_t *pos)
+static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
+                                size_t count, loff_t *pos)
 {
        struct atm_dev *dev;
        unsigned long page;
index a72dc2d4284610b370b0a368daaf07883dd5e4fd..58de2ac939744b9a2b3193de3407f372257f15ff 100644 (file)
@@ -180,7 +180,7 @@ static void subtract_aal_stats(struct k_atm_aal_stats *from,
 }
 
 
-static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats *arg, int zero)
+static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, int zero)
 {
        struct atm_dev_stats tmp;
        int error = 0;
@@ -199,19 +199,20 @@ static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats *arg, int zero)
 }
 
 
-int atm_dev_ioctl(unsigned int cmd, unsigned long arg)
+int atm_dev_ioctl(unsigned int cmd, void __user *arg)
 {
-       void *buf;
+       void __user *buf;
        int error, len, number, size = 0;
        struct atm_dev *dev;
        struct list_head *p;
        int *tmp_buf, *tmp_p;
-
+       struct atm_iobuf __user *iobuf = arg;
+       struct atmif_sioc __user *sioc = arg;
        switch (cmd) {
                case ATM_GETNAMES:
-                       if (get_user(buf, &((struct atm_iobuf *) arg)->buffer))
+                       if (get_user(buf, &iobuf->buffer))
                                return -EFAULT;
-                       if (get_user(len, &((struct atm_iobuf *) arg)->length))
+                       if (get_user(len, &iobuf->length))
                                return -EFAULT;
                        spin_lock(&atm_dev_lock);
                        list_for_each(p, &atm_devs)
@@ -232,7 +233,7 @@ int atm_dev_ioctl(unsigned int cmd, unsigned long arg)
                        }
                        spin_unlock(&atm_dev_lock);
                        error = ((copy_to_user(buf, tmp_buf, size)) ||
-                                       put_user(size, &((struct atm_iobuf *) arg)->length))
+                                       put_user(size, &iobuf->length))
                                                ? -EFAULT : 0;
                        kfree(tmp_buf);
                        return error;
@@ -240,11 +241,11 @@ int atm_dev_ioctl(unsigned int cmd, unsigned long arg)
                        break;
        }
 
-       if (get_user(buf, &((struct atmif_sioc *) arg)->arg))
+       if (get_user(buf, &sioc->arg))
                return -EFAULT;
-       if (get_user(len, &((struct atmif_sioc *) arg)->length))
+       if (get_user(len, &sioc->length))
                return -EFAULT;
-       if (get_user(number, &((struct atmif_sioc *) arg)->number))
+       if (get_user(number, &sioc->number))
                return -EFAULT;
 
        if (!(dev = atm_dev_lookup(number)))
@@ -351,7 +352,7 @@ int atm_dev_ioctl(unsigned int cmd, unsigned long arg)
                        size = error;
                        /* may return 0, but later on size == 0 means "don't
                           write the length" */
-                       error = put_user(size, &((struct atmif_sioc *) arg)->length)
+                       error = put_user(size, &sioc->length)
                                ? -EFAULT : 0;
                        goto done;
                case ATM_SETLOOP:
@@ -385,7 +386,7 @@ int atm_dev_ioctl(unsigned int cmd, unsigned long arg)
        }
        
        if (size)
-               error = put_user(size, &((struct atmif_sioc *) arg)->length)
+               error = put_user(size, &sioc->length)
                        ? -EFAULT : 0;
        else
                error = 0;
index 5f69a949eebf4cd21c503593b34011c9d5e4e2d1..12910619dbb6cdfed3cb5b56268769263125ad63 100644 (file)
@@ -14,7 +14,7 @@ extern struct list_head atm_devs;
 extern spinlock_t atm_dev_lock;
 
 
-int atm_dev_ioctl(unsigned int cmd, unsigned long arg);
+int atm_dev_ioctl(unsigned int cmd, void __user *arg);
 
 
 #ifdef CONFIG_PROC_FS