struct atmif_sioc {
int number;
int length;
- void *arg;
+ void __user *arg;
};
typedef unsigned short atm_backend_t;
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,
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);
};
}
-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;
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;
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
#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) {
/*
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()
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)
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;
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) {
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)
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:
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 */
}
struct atm_vcc *vcc;
struct sk_buff *skb;
int eff,error;
- const void *buff;
+ const void __user *buff;
int size;
lock_sock(sk);
}
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;
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;
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;
-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;
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);
struct atm_vcc *vcc;
int error;
struct list_head * pos;
+ void __user *argp = (void __user *)arg;
vcc = ATM_SD(sock);
switch (cmd) {
}
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:
{
}
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");
if (error != -ENOIOCTLCMD)
goto done;
- error = atm_dev_ioctl(cmd, arg);
+ error = atm_dev_ioctl(cmd, argp);
done:
return error;
}
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;
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;
}
#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);
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;
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;
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;
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;
/* 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;
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);
/*
* 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;
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;
{
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;
.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;
* 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)
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;
}
#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 = {
.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;
}
-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;
}
-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)
}
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;
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)))
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:
}
if (size)
- error = put_user(size, &((struct atmif_sioc *) arg)->length)
+ error = put_user(size, &sioc->length)
? -EFAULT : 0;
else
error = 0;
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