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

[PATCH] sparse: trivial drivers/isdn/* annotations

parent f4a4c86b
...@@ -650,7 +650,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) ...@@ -650,7 +650,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
/* -------- file_operations for capidev ----------------------------- */ /* -------- file_operations for capidev ----------------------------- */
static ssize_t static ssize_t
capi_read(struct file *file, char *buf, size_t count, loff_t *ppos) capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{ {
struct capidev *cdev = (struct capidev *)file->private_data; struct capidev *cdev = (struct capidev *)file->private_data;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -693,7 +693,7 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos) ...@@ -693,7 +693,7 @@ capi_read(struct file *file, char *buf, size_t count, loff_t *ppos)
} }
static ssize_t static ssize_t
capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos) capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ {
struct capidev *cdev = (struct capidev *)file->private_data; struct capidev *cdev = (struct capidev *)file->private_data;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -766,6 +766,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -766,6 +766,7 @@ capi_ioctl(struct inode *inode, struct file *file,
struct capi20_appl *ap = &cdev->ap; struct capi20_appl *ap = &cdev->ap;
capi_ioctl_struct data; capi_ioctl_struct data;
int retval = -EINVAL; int retval = -EINVAL;
void __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case CAPI_REGISTER: case CAPI_REGISTER:
...@@ -773,7 +774,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -773,7 +774,7 @@ capi_ioctl(struct inode *inode, struct file *file,
if (ap->applid) if (ap->applid)
return -EEXIST; return -EEXIST;
if (copy_from_user(&cdev->ap.rparam, (void *) arg, if (copy_from_user(&cdev->ap.rparam, argp,
sizeof(struct capi_register_params))) sizeof(struct capi_register_params)))
return -EFAULT; return -EFAULT;
...@@ -789,14 +790,13 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -789,14 +790,13 @@ capi_ioctl(struct inode *inode, struct file *file,
case CAPI_GET_VERSION: case CAPI_GET_VERSION:
{ {
if (copy_from_user((void *) &data.contr, if (copy_from_user(&data.contr, argp,
(void *) arg,
sizeof(data.contr))) sizeof(data.contr)))
return -EFAULT; return -EFAULT;
cdev->errcode = capi20_get_version(data.contr, &data.version); cdev->errcode = capi20_get_version(data.contr, &data.version);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
if (copy_to_user((void *)arg, (void *)&data.version, if (copy_to_user(argp, &data.version,
sizeof(data.version))) sizeof(data.version)))
return -EFAULT; return -EFAULT;
} }
...@@ -804,20 +804,20 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -804,20 +804,20 @@ capi_ioctl(struct inode *inode, struct file *file,
case CAPI_GET_SERIAL: case CAPI_GET_SERIAL:
{ {
if (copy_from_user((void *)&data.contr, (void *)arg, if (copy_from_user(&data.contr, argp,
sizeof(data.contr))) sizeof(data.contr)))
return -EFAULT; return -EFAULT;
cdev->errcode = capi20_get_serial (data.contr, data.serial); cdev->errcode = capi20_get_serial (data.contr, data.serial);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
if (copy_to_user((void *)arg, (void *)data.serial, if (copy_to_user(argp, data.serial,
sizeof(data.serial))) sizeof(data.serial)))
return -EFAULT; return -EFAULT;
} }
return 0; return 0;
case CAPI_GET_PROFILE: case CAPI_GET_PROFILE:
{ {
if (copy_from_user((void *)&data.contr, (void *)arg, if (copy_from_user(&data.contr, argp,
sizeof(data.contr))) sizeof(data.contr)))
return -EFAULT; return -EFAULT;
...@@ -826,8 +826,8 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -826,8 +826,8 @@ capi_ioctl(struct inode *inode, struct file *file,
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
retval = copy_to_user((void *) arg, retval = copy_to_user(argp,
(void *) &data.profile.ncontroller, &data.profile.ncontroller,
sizeof(data.profile.ncontroller)); sizeof(data.profile.ncontroller));
} else { } else {
...@@ -835,8 +835,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -835,8 +835,7 @@ capi_ioctl(struct inode *inode, struct file *file,
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
retval = copy_to_user((void *) arg, retval = copy_to_user(argp, &data.profile,
(void *) &data.profile,
sizeof(data.profile)); sizeof(data.profile));
} }
if (retval) if (retval)
...@@ -846,14 +845,14 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -846,14 +845,14 @@ capi_ioctl(struct inode *inode, struct file *file,
case CAPI_GET_MANUFACTURER: case CAPI_GET_MANUFACTURER:
{ {
if (copy_from_user((void *)&data.contr, (void *)arg, if (copy_from_user(&data.contr, argp,
sizeof(data.contr))) sizeof(data.contr)))
return -EFAULT; return -EFAULT;
cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer); cdev->errcode = capi20_get_manufacturer(data.contr, data.manufacturer);
if (cdev->errcode) if (cdev->errcode)
return -EIO; return -EIO;
if (copy_to_user((void *)arg, (void *)data.manufacturer, if (copy_to_user(argp, data.manufacturer,
sizeof(data.manufacturer))) sizeof(data.manufacturer)))
return -EFAULT; return -EFAULT;
...@@ -863,7 +862,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -863,7 +862,7 @@ capi_ioctl(struct inode *inode, struct file *file,
data.errcode = cdev->errcode; data.errcode = cdev->errcode;
cdev->errcode = CAPI_NOERROR; cdev->errcode = CAPI_NOERROR;
if (arg) { if (arg) {
if (copy_to_user((void *)arg, (void *)&data.errcode, if (copy_to_user(argp, &data.errcode,
sizeof(data.errcode))) sizeof(data.errcode)))
return -EFAULT; return -EFAULT;
} }
...@@ -879,7 +878,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -879,7 +878,7 @@ capi_ioctl(struct inode *inode, struct file *file,
struct capi_manufacturer_cmd mcmd; struct capi_manufacturer_cmd mcmd;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (copy_from_user((void *)&mcmd, (void *)arg, if (copy_from_user(&mcmd, argp,
sizeof(mcmd))) sizeof(mcmd)))
return -EFAULT; return -EFAULT;
return capi20_manufacturer(mcmd.cmd, mcmd.data); return capi20_manufacturer(mcmd.cmd, mcmd.data);
...@@ -890,7 +889,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -890,7 +889,7 @@ capi_ioctl(struct inode *inode, struct file *file,
case CAPI_CLR_FLAGS: case CAPI_CLR_FLAGS:
{ {
unsigned userflags; unsigned userflags;
if (copy_from_user((void *)&userflags, (void *)arg, if (copy_from_user(&userflags, argp,
sizeof(userflags))) sizeof(userflags)))
return -EFAULT; return -EFAULT;
if (cmd == CAPI_SET_FLAGS) if (cmd == CAPI_SET_FLAGS)
...@@ -901,7 +900,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -901,7 +900,7 @@ capi_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
case CAPI_GET_FLAGS: case CAPI_GET_FLAGS:
if (copy_to_user((void *)arg, (void *)&cdev->userflags, if (copy_to_user(argp, &cdev->userflags,
sizeof(cdev->userflags))) sizeof(cdev->userflags)))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -914,8 +913,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -914,8 +913,7 @@ capi_ioctl(struct inode *inode, struct file *file,
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
unsigned ncci; unsigned ncci;
int count = 0; int count = 0;
if (copy_from_user((void *)&ncci, (void *)arg, if (copy_from_user(&ncci, argp, sizeof(ncci)))
sizeof(ncci)))
return -EFAULT; return -EFAULT;
down(&cdev->ncci_list_sem); down(&cdev->ncci_list_sem);
...@@ -940,7 +938,7 @@ capi_ioctl(struct inode *inode, struct file *file, ...@@ -940,7 +938,7 @@ capi_ioctl(struct inode *inode, struct file *file,
struct capiminor *mp; struct capiminor *mp;
unsigned ncci; unsigned ncci;
int unit = 0; int unit = 0;
if (copy_from_user((void *)&ncci, (void *)arg, if (copy_from_user(&ncci, argp,
sizeof(ncci))) sizeof(ncci)))
return -EFAULT; return -EFAULT;
down(&cdev->ncci_list_sem); down(&cdev->ncci_list_sem);
......
...@@ -64,7 +64,7 @@ static isdn_divert_if *divert_if; /* = NULL */ ...@@ -64,7 +64,7 @@ static isdn_divert_if *divert_if; /* = NULL */
#endif /* CONFIG_ISDN_DIVERSION */ #endif /* CONFIG_ISDN_DIVERSION */
static int isdn_writebuf_stub(int, int, const u_char *, int, int); static int isdn_writebuf_stub(int, int, const u_char __user *, int);
static void set_global_features(void); static void set_global_features(void);
static int isdn_wildmat(char *s, char *p); static int isdn_wildmat(char *s, char *p);
...@@ -937,7 +937,7 @@ isdn_info_update(void) ...@@ -937,7 +937,7 @@ isdn_info_update(void)
} }
static ssize_t static ssize_t
isdn_read(struct file *file, char *buf, size_t count, loff_t * off) isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
{ {
uint minor = MINOR(file->f_dentry->d_inode->i_rdev); uint minor = MINOR(file->f_dentry->d_inode->i_rdev);
int len = 0; int len = 0;
...@@ -1044,7 +1044,7 @@ isdn_read(struct file *file, char *buf, size_t count, loff_t * off) ...@@ -1044,7 +1044,7 @@ isdn_read(struct file *file, char *buf, size_t count, loff_t * off)
} }
static ssize_t static ssize_t
isdn_write(struct file *file, const char *buf, size_t count, loff_t * off) isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
{ {
uint minor = MINOR(file->f_dentry->d_inode->i_rdev); uint minor = MINOR(file->f_dentry->d_inode->i_rdev);
int drvidx; int drvidx;
...@@ -1159,7 +1159,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1159,7 +1159,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
int chidx; int chidx;
int ret; int ret;
int i; int i;
char *p; char __user *p;
char *s; char *s;
union iocpar { union iocpar {
char name[10]; char name[10];
...@@ -1168,6 +1168,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1168,6 +1168,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
isdn_net_ioctl_phone phone; isdn_net_ioctl_phone phone;
isdn_net_ioctl_cfg cfg; isdn_net_ioctl_cfg cfg;
} iocpar; } iocpar;
void __user *argp = (void __user *)arg;
#define name iocpar.name #define name iocpar.name
#define bname iocpar.bname #define bname iocpar.bname
...@@ -1183,9 +1184,9 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1183,9 +1184,9 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
(INF_DV << 16)); (INF_DV << 16));
case IIOCGETCPS: case IIOCGETCPS:
if (arg) { if (arg) {
ulong *p = (ulong *) arg; ulong __user *p = argp;
int i; int i;
if ((ret = verify_area(VERIFY_WRITE, (void *) arg, if ((ret = verify_area(VERIFY_WRITE, p,
sizeof(ulong) * ISDN_MAX_CHANNELS * 2))) sizeof(ulong) * ISDN_MAX_CHANNELS * 2)))
return ret; return ret;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) { for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
...@@ -1201,9 +1202,9 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1201,9 +1202,9 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
/* Get peer phone number of a connected /* Get peer phone number of a connected
* isdn network interface */ * isdn network interface */
if (arg) { if (arg) {
if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone))) if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT; return -EFAULT;
return isdn_net_getpeer(&phone, (isdn_net_ioctl_phone *) arg); return isdn_net_getpeer(&phone, argp);
} else } else
return -EINVAL; return -EINVAL;
#endif #endif
...@@ -1241,7 +1242,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1241,7 +1242,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETAIF: case IIOCNETAIF:
/* Add a network-interface */ /* Add a network-interface */
if (arg) { if (arg) {
if (copy_from_user(name, (char *) arg, sizeof(name))) if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT; return -EFAULT;
s = name; s = name;
} else { } else {
...@@ -1250,7 +1251,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1250,7 +1251,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
ret = down_interruptible(&dev->sem); ret = down_interruptible(&dev->sem);
if( ret ) return ret; if( ret ) return ret;
if ((s = isdn_net_new(s, NULL))) { if ((s = isdn_net_new(s, NULL))) {
if (copy_to_user((char *) arg, s, strlen(s) + 1)){ if (copy_to_user(argp, s, strlen(s) + 1)){
ret = -EFAULT; ret = -EFAULT;
} else { } else {
ret = 0; ret = 0;
...@@ -1262,14 +1263,14 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1262,14 +1263,14 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETASL: case IIOCNETASL:
/* Add a slave to a network-interface */ /* Add a slave to a network-interface */
if (arg) { if (arg) {
if (copy_from_user(bname, (char *) arg, sizeof(bname) - 1)) if (copy_from_user(bname, argp, sizeof(bname) - 1))
return -EFAULT; return -EFAULT;
} else } else
return -EINVAL; return -EINVAL;
ret = down_interruptible(&dev->sem); ret = down_interruptible(&dev->sem);
if( ret ) return ret; if( ret ) return ret;
if ((s = isdn_net_newslave(bname))) { if ((s = isdn_net_newslave(bname))) {
if (copy_to_user((char *) arg, s, strlen(s) + 1)){ if (copy_to_user(argp, s, strlen(s) + 1)){
ret = -EFAULT; ret = -EFAULT;
} else { } else {
ret = 0; ret = 0;
...@@ -1281,7 +1282,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1281,7 +1282,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETDIF: case IIOCNETDIF:
/* Delete a network-interface */ /* Delete a network-interface */
if (arg) { if (arg) {
if (copy_from_user(name, (char *) arg, sizeof(name))) if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT; return -EFAULT;
ret = down_interruptible(&dev->sem); ret = down_interruptible(&dev->sem);
if( ret ) return ret; if( ret ) return ret;
...@@ -1293,7 +1294,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1293,7 +1294,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETSCF: case IIOCNETSCF:
/* Set configurable parameters of a network-interface */ /* Set configurable parameters of a network-interface */
if (arg) { if (arg) {
if (copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg))) if (copy_from_user(&cfg, argp, sizeof(cfg)))
return -EFAULT; return -EFAULT;
return isdn_net_setcfg(&cfg); return isdn_net_setcfg(&cfg);
} else } else
...@@ -1301,10 +1302,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1301,10 +1302,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETGCF: case IIOCNETGCF:
/* Get configurable parameters of a network-interface */ /* Get configurable parameters of a network-interface */
if (arg) { if (arg) {
if (copy_from_user((char *) &cfg, (char *) arg, sizeof(cfg))) if (copy_from_user(&cfg, argp, sizeof(cfg)))
return -EFAULT; return -EFAULT;
if (!(ret = isdn_net_getcfg(&cfg))) { if (!(ret = isdn_net_getcfg(&cfg))) {
if (copy_to_user((char *) arg, (char *) &cfg, sizeof(cfg))) if (copy_to_user(argp, &cfg, sizeof(cfg)))
return -EFAULT; return -EFAULT;
} }
return ret; return ret;
...@@ -1313,7 +1314,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1313,7 +1314,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETANM: case IIOCNETANM:
/* Add a phone-number to a network-interface */ /* Add a phone-number to a network-interface */
if (arg) { if (arg) {
if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone))) if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT; return -EFAULT;
ret = down_interruptible(&dev->sem); ret = down_interruptible(&dev->sem);
if( ret ) return ret; if( ret ) return ret;
...@@ -1325,11 +1326,11 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1325,11 +1326,11 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETGNM: case IIOCNETGNM:
/* Get list of phone-numbers of a network-interface */ /* Get list of phone-numbers of a network-interface */
if (arg) { if (arg) {
if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone))) if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT; return -EFAULT;
ret = down_interruptible(&dev->sem); ret = down_interruptible(&dev->sem);
if( ret ) return ret; if( ret ) return ret;
ret = isdn_net_getphones(&phone, (char *) arg); ret = isdn_net_getphones(&phone, argp);
up(&dev->sem); up(&dev->sem);
return ret; return ret;
} else } else
...@@ -1337,7 +1338,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1337,7 +1338,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETDNM: case IIOCNETDNM:
/* Delete a phone-number of a network-interface */ /* Delete a phone-number of a network-interface */
if (arg) { if (arg) {
if (copy_from_user((char *) &phone, (char *) arg, sizeof(phone))) if (copy_from_user(&phone, argp, sizeof(phone)))
return -EFAULT; return -EFAULT;
ret = down_interruptible(&dev->sem); ret = down_interruptible(&dev->sem);
if( ret ) return ret; if( ret ) return ret;
...@@ -1349,7 +1350,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1349,7 +1350,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETDIL: case IIOCNETDIL:
/* Force dialing of a network-interface */ /* Force dialing of a network-interface */
if (arg) { if (arg) {
if (copy_from_user(name, (char *) arg, sizeof(name))) if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT; return -EFAULT;
return isdn_net_force_dial(name); return isdn_net_force_dial(name);
} else } else
...@@ -1358,13 +1359,13 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1358,13 +1359,13 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCNETALN: case IIOCNETALN:
if (!arg) if (!arg)
return -EINVAL; return -EINVAL;
if (copy_from_user(name, (char *) arg, sizeof(name))) if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT; return -EFAULT;
return isdn_ppp_dial_slave(name); return isdn_ppp_dial_slave(name);
case IIOCNETDLN: case IIOCNETDLN:
if (!arg) if (!arg)
return -EINVAL; return -EINVAL;
if (copy_from_user(name, (char *) arg, sizeof(name))) if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT; return -EFAULT;
return isdn_ppp_hangup_slave(name); return isdn_ppp_hangup_slave(name);
#endif #endif
...@@ -1372,7 +1373,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1372,7 +1373,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
/* Force hangup of a network-interface */ /* Force hangup of a network-interface */
if (!arg) if (!arg)
return -EINVAL; return -EINVAL;
if (copy_from_user(name, (char *) arg, sizeof(name))) if (copy_from_user(name, argp, sizeof(name)))
return -EFAULT; return -EFAULT;
return isdn_net_force_hangup(name); return isdn_net_force_hangup(name);
break; break;
...@@ -1394,7 +1395,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1394,7 +1395,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
if (arg) { if (arg) {
int i; int i;
char *p; char *p;
if (copy_from_user((char *) &iocts, (char *) arg, if (copy_from_user(&iocts, argp,
sizeof(isdn_ioctl_struct))) sizeof(isdn_ioctl_struct)))
return -EFAULT; return -EFAULT;
if (strlen(iocts.drvid)) { if (strlen(iocts.drvid)) {
...@@ -1422,10 +1423,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1422,10 +1423,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCGETPRF: case IIOCGETPRF:
/* Get all Modem-Profiles */ /* Get all Modem-Profiles */
if (arg) { if (arg) {
char *p = (char *) arg; char __user *p = argp;
int i; int i;
if ((ret = verify_area(VERIFY_WRITE, (void *) arg, if ((ret = verify_area(VERIFY_WRITE, argp,
(ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
* ISDN_MAX_CHANNELS))) * ISDN_MAX_CHANNELS)))
return ret; return ret;
...@@ -1449,10 +1450,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1449,10 +1450,10 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
case IIOCSETPRF: case IIOCSETPRF:
/* Set all Modem-Profiles */ /* Set all Modem-Profiles */
if (arg) { if (arg) {
char *p = (char *) arg; char __user *p = argp;
int i; int i;
if ((ret = verify_area(VERIFY_READ, (void *) arg, if ((ret = verify_area(VERIFY_READ, argp,
(ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
* ISDN_MAX_CHANNELS))) * ISDN_MAX_CHANNELS)))
return ret; return ret;
...@@ -1478,8 +1479,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1478,8 +1479,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
/* Set/Get MSN->EAZ-Mapping for a driver */ /* Set/Get MSN->EAZ-Mapping for a driver */
if (arg) { if (arg) {
if (copy_from_user((char *) &iocts, if (copy_from_user(&iocts, argp,
(char *) arg,
sizeof(isdn_ioctl_struct))) sizeof(isdn_ioctl_struct)))
return -EFAULT; return -EFAULT;
if (strlen(iocts.drvid)) { if (strlen(iocts.drvid)) {
...@@ -1496,7 +1496,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1496,7 +1496,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
if (cmd == IIOCSETMAP) { if (cmd == IIOCSETMAP) {
int loop = 1; int loop = 1;
p = (char *) iocts.arg; p = (char __user *) iocts.arg;
i = 0; i = 0;
while (loop) { while (loop) {
int j = 0; int j = 0;
...@@ -1524,7 +1524,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1524,7 +1524,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
break; break;
} }
} else { } else {
p = (char *) iocts.arg; p = (char __user *) iocts.arg;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
sprintf(bname, "%s%s", sprintf(bname, "%s%s",
strlen(dev->drv[drvidx]->msn2eaz[i]) ? strlen(dev->drv[drvidx]->msn2eaz[i]) ?
...@@ -1540,7 +1540,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1540,7 +1540,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
return -EINVAL; return -EINVAL;
case IIOCDBGVAR: case IIOCDBGVAR:
if (arg) { if (arg) {
if (copy_to_user((char *) arg, (char *) &dev, sizeof(ulong))) if (copy_to_user(argp, &dev, sizeof(ulong)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} else } else
...@@ -1554,7 +1554,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1554,7 +1554,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
if (arg) { if (arg) {
int i; int i;
char *p; char *p;
if (copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct))) if (copy_from_user(&iocts, argp, sizeof(isdn_ioctl_struct)))
return -EFAULT; return -EFAULT;
if (strlen(iocts.drvid)) { if (strlen(iocts.drvid)) {
if ((p = strchr(iocts.drvid, ','))) if ((p = strchr(iocts.drvid, ',')))
...@@ -1569,16 +1569,16 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg) ...@@ -1569,16 +1569,16 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
drvidx = 0; drvidx = 0;
if (drvidx == -1) if (drvidx == -1)
return -ENODEV; return -ENODEV;
if ((ret = verify_area(VERIFY_WRITE, (void *) arg, if ((ret = verify_area(VERIFY_WRITE, argp,
sizeof(isdn_ioctl_struct)))) sizeof(isdn_ioctl_struct))))
return ret; return ret;
c.driver = drvidx; c.driver = drvidx;
c.command = ISDN_CMD_IOCTL; c.command = ISDN_CMD_IOCTL;
c.arg = cmd; c.arg = cmd;
memcpy(c.parm.num, (char *) &iocts.arg, sizeof(ulong)); memcpy(c.parm.num, &iocts.arg, sizeof(ulong));
ret = isdn_command(&c); ret = isdn_command(&c);
memcpy((char *) &iocts.arg, c.parm.num, sizeof(ulong)); memcpy(&iocts.arg, c.parm.num, sizeof(ulong));
if (copy_to_user((char *) arg, &iocts, sizeof(isdn_ioctl_struct))) if (copy_to_user(argp, &iocts, sizeof(isdn_ioctl_struct)))
return -EFAULT; return -EFAULT;
return ret; return ret;
} else } else
......
...@@ -315,7 +315,7 @@ isdn_net_unbind_channel(isdn_net_local * lp) ...@@ -315,7 +315,7 @@ isdn_net_unbind_channel(isdn_net_local * lp)
unsigned long last_jiffies = -HZ; unsigned long last_jiffies = -HZ;
void void
isdn_net_autohup() isdn_net_autohup(void)
{ {
isdn_net_dev *p = dev->netdev; isdn_net_dev *p = dev->netdev;
int anymore; int anymore;
...@@ -1443,15 +1443,14 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1443,15 +1443,14 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
/* get/set keepalive period */ /* get/set keepalive period */
case SIOCGKEEPPERIOD: case SIOCGKEEPPERIOD:
len = (unsigned long)sizeof(lp->cisco_keepalive_period); len = (unsigned long)sizeof(lp->cisco_keepalive_period);
if (copy_to_user((char *)ifr->ifr_ifru.ifru_data, if (copy_to_user(ifr->ifr_data,
(int *)&lp->cisco_keepalive_period, len)) &lp->cisco_keepalive_period, len))
rc = -EFAULT; rc = -EFAULT;
break; break;
case SIOCSKEEPPERIOD: case SIOCSKEEPPERIOD:
tmp = lp->cisco_keepalive_period; tmp = lp->cisco_keepalive_period;
len = (unsigned long)sizeof(lp->cisco_keepalive_period); len = (unsigned long)sizeof(lp->cisco_keepalive_period);
if (copy_from_user((int *)&period, if (copy_from_user(&period, ifr->ifr_data, len))
(char *)ifr->ifr_ifru.ifru_data, len))
rc = -EFAULT; rc = -EFAULT;
if ((period > 0) && (period <= 32767)) if ((period > 0) && (period <= 32767))
lp->cisco_keepalive_period = period; lp->cisco_keepalive_period = period;
...@@ -1470,14 +1469,14 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1470,14 +1469,14 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
/* get/set debugging */ /* get/set debugging */
case SIOCGDEBSERINT: case SIOCGDEBSERINT:
len = (unsigned long)sizeof(lp->cisco_debserint); len = (unsigned long)sizeof(lp->cisco_debserint);
if (copy_to_user((char *)ifr->ifr_ifru.ifru_data, if (copy_to_user(ifr->ifr_data,
(char *)&lp->cisco_debserint, len)) &lp->cisco_debserint, len))
rc = -EFAULT; rc = -EFAULT;
break; break;
case SIOCSDEBSERINT: case SIOCSDEBSERINT:
len = (unsigned long)sizeof(lp->cisco_debserint); len = (unsigned long)sizeof(lp->cisco_debserint);
if (copy_from_user((char *)&debserint, if (copy_from_user(&debserint,
(char *)ifr->ifr_ifru.ifru_data, len)) ifr->ifr_data, len))
rc = -EFAULT; rc = -EFAULT;
if ((debserint >= 0) && (debserint <= 64)) if ((debserint >= 0) && (debserint <= 64))
lp->cisco_debserint = debserint; lp->cisco_debserint = debserint;
...@@ -2968,7 +2967,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone) ...@@ -2968,7 +2967,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone)
* This might sleep and must be called with the isdn semaphore down. * This might sleep and must be called with the isdn semaphore down.
*/ */
int int
isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones) isdn_net_getphones(isdn_net_ioctl_phone * phone, char __user *phones)
{ {
isdn_net_dev *p = isdn_net_findif(phone->name); isdn_net_dev *p = isdn_net_findif(phone->name);
int inout = phone->outgoing & 1; int inout = phone->outgoing & 1;
...@@ -3001,7 +3000,7 @@ isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones) ...@@ -3001,7 +3000,7 @@ isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones)
* to user space. * to user space.
*/ */
int int
isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer) isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer)
{ {
isdn_net_dev *p = isdn_net_findif(phone->name); isdn_net_dev *p = isdn_net_findif(phone->name);
int ch, dv, idx; int ch, dv, idx;
......
...@@ -39,8 +39,8 @@ extern int isdn_net_stat_callback(int, isdn_ctrl *); ...@@ -39,8 +39,8 @@ extern int isdn_net_stat_callback(int, isdn_ctrl *);
extern int isdn_net_setcfg(isdn_net_ioctl_cfg *); extern int isdn_net_setcfg(isdn_net_ioctl_cfg *);
extern int isdn_net_getcfg(isdn_net_ioctl_cfg *); extern int isdn_net_getcfg(isdn_net_ioctl_cfg *);
extern int isdn_net_addphone(isdn_net_ioctl_phone *); extern int isdn_net_addphone(isdn_net_ioctl_phone *);
extern int isdn_net_getphones(isdn_net_ioctl_phone *, char *); extern int isdn_net_getphones(isdn_net_ioctl_phone *, char __user *);
extern int isdn_net_getpeer(isdn_net_ioctl_phone *, isdn_net_ioctl_phone *); extern int isdn_net_getpeer(isdn_net_ioctl_phone *, isdn_net_ioctl_phone __user *);
extern int isdn_net_delphone(isdn_net_ioctl_phone *); extern int isdn_net_delphone(isdn_net_ioctl_phone *);
extern int isdn_net_find_icall(int, int, int, setup_parm *); extern int isdn_net_find_icall(int, int, int, setup_parm *);
extern void isdn_net_hangup(struct net_device *); extern void isdn_net_hangup(struct net_device *);
......
...@@ -1359,14 +1359,14 @@ isdn_tty_unthrottle(struct tty_struct *tty) ...@@ -1359,14 +1359,14 @@ isdn_tty_unthrottle(struct tty_struct *tty)
* allows RS485 driver to be written in user space. * allows RS485 driver to be written in user space.
*/ */
static int static int
isdn_tty_get_lsr_info(modem_info * info, uint * value) isdn_tty_get_lsr_info(modem_info * info, uint __user * value)
{ {
u_char status; u_char status;
uint result; uint result;
status = info->lsr; status = info->lsr;
result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0); result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
return put_user(result, (uint *) value); return put_user(result, value);
} }
...@@ -1468,12 +1468,12 @@ isdn_tty_ioctl(struct tty_struct *tty, struct file *file, ...@@ -1468,12 +1468,12 @@ isdn_tty_ioctl(struct tty_struct *tty, struct file *file,
#ifdef ISDN_DEBUG_MODEM_IOCTL #ifdef ISDN_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "ttyI%d ioctl TIOCGSOFTCAR\n", info->line); printk(KERN_DEBUG "ttyI%d ioctl TIOCGSOFTCAR\n", info->line);
#endif #endif
return put_user(C_CLOCAL(tty) ? 1 : 0, (ulong *) arg); return put_user(C_CLOCAL(tty) ? 1 : 0, (ulong __user *) arg);
case TIOCSSOFTCAR: case TIOCSSOFTCAR:
#ifdef ISDN_DEBUG_MODEM_IOCTL #ifdef ISDN_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "ttyI%d ioctl TIOCSSOFTCAR\n", info->line); printk(KERN_DEBUG "ttyI%d ioctl TIOCSSOFTCAR\n", info->line);
#endif #endif
if (get_user(arg, (ulong *) arg)) if (get_user(arg, (ulong __user *) arg))
return -EFAULT; return -EFAULT;
tty->termios->c_cflag = tty->termios->c_cflag =
((tty->termios->c_cflag & ~CLOCAL) | ((tty->termios->c_cflag & ~CLOCAL) |
......
...@@ -79,7 +79,7 @@ static int pdata_is_bad( ix25_pdata_t * pda ){ ...@@ -79,7 +79,7 @@ static int pdata_is_bad( ix25_pdata_t * pda ){
/* create a new x25 interface protocol instance /* create a new x25 interface protocol instance
*/ */
struct concap_proto * isdn_x25iface_proto_new() struct concap_proto * isdn_x25iface_proto_new(void)
{ {
ix25_pdata_t * tmp = kmalloc(sizeof(ix25_pdata_t),GFP_KERNEL); ix25_pdata_t * tmp = kmalloc(sizeof(ix25_pdata_t),GFP_KERNEL);
IX25DEBUG("isdn_x25iface_proto_new\n"); IX25DEBUG("isdn_x25iface_proto_new\n");
...@@ -275,8 +275,7 @@ int isdn_x25iface_disconn_ind(struct concap_proto *cprot) ...@@ -275,8 +275,7 @@ int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb) int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb)
{ {
unsigned char firstbyte = skb->data[0]; unsigned char firstbyte = skb->data[0];
unsigned *state = enum wan_states *state = &((ix25_pdata_t*)cprot->proto_data)->state;
&( ( (ix25_pdata_t*) (cprot -> proto_data) ) -> state );
int ret = 0; int ret = 0;
IX25DEBUG( "isdn_x25iface_xmit: %s first=%x state=%d \n", MY_DEVNAME(cprot -> net_dev), firstbyte, *state ); IX25DEBUG( "isdn_x25iface_xmit: %s first=%x state=%d \n", MY_DEVNAME(cprot -> net_dev), firstbyte, *state );
switch ( firstbyte ){ switch ( firstbyte ){
......
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