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

[PATCH] sparse: irda annotation

parent 717b0cbc
...@@ -1779,7 +1779,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1779,7 +1779,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); amount = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
if (amount < 0) if (amount < 0)
amount = 0; amount = 0;
if (put_user(amount, (unsigned int *)arg)) if (put_user(amount, (unsigned int __user *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -1790,7 +1790,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) ...@@ -1790,7 +1790,7 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
/* These two are safe on a single CPU system as only user tasks fiddle here */ /* These two are safe on a single CPU system as only user tasks fiddle here */
if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL)
amount = skb->len; amount = skb->len;
if (put_user(amount, (unsigned int *)arg)) if (put_user(amount, (unsigned int __user *)arg))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
......
...@@ -260,7 +260,7 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -260,7 +260,7 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
* *
*/ */
static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
struct serial_struct *retinfo) struct serial_struct __user *retinfo)
{ {
struct serial_struct info; struct serial_struct info;
...@@ -297,7 +297,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, ...@@ -297,7 +297,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self,
* *
*/ */
static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self,
struct serial_struct *new_info) struct serial_struct __user *new_info)
{ {
#if 0 #if 0
struct serial_struct new_serial; struct serial_struct new_serial;
...@@ -388,10 +388,10 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, ...@@ -388,10 +388,10 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
switch (cmd) { switch (cmd) {
case TIOCGSERIAL: case TIOCGSERIAL:
ret = ircomm_tty_get_serial_info(self, (struct serial_struct *) arg); ret = ircomm_tty_get_serial_info(self, (struct serial_struct __user *) arg);
break; break;
case TIOCSSERIAL: case TIOCSSERIAL:
ret = ircomm_tty_set_serial_info(self, (struct serial_struct *) arg); ret = ircomm_tty_set_serial_info(self, (struct serial_struct __user *) arg);
break; break;
case TIOCMIWAIT: case TIOCMIWAIT:
IRDA_DEBUG(0, "(), TIOCMIWAIT, not impl!\n"); IRDA_DEBUG(0, "(), TIOCMIWAIT, not impl!\n");
...@@ -403,7 +403,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, ...@@ -403,7 +403,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
save_flags(flags); cli(); save_flags(flags); cli();
cnow = driver->icount; cnow = driver->icount;
restore_flags(flags); restore_flags(flags);
p_cuser = (struct serial_icounter_struct *) arg; p_cuser = (struct serial_icounter_struct __user *) arg;
if (put_user(cnow.cts, &p_cuser->cts) || if (put_user(cnow.cts, &p_cuser->cts) ||
put_user(cnow.dsr, &p_cuser->dsr) || put_user(cnow.dsr, &p_cuser->dsr) ||
put_user(cnow.rng, &p_cuser->rng) || put_user(cnow.rng, &p_cuser->rng) ||
......
...@@ -804,7 +804,7 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason, ...@@ -804,7 +804,7 @@ void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
* Note : separate from irlmp_do_discovery() so that we can handle * Note : separate from irlmp_do_discovery() so that we can handle
* passive discovery properly. * passive discovery properly.
*/ */
void irlmp_do_expiry() void irlmp_do_expiry(void)
{ {
struct lap_cb *lap; struct lap_cb *lap;
...@@ -1078,7 +1078,7 @@ void irlmp_discovery_expiry(discinfo_t *expiries, int number) ...@@ -1078,7 +1078,7 @@ void irlmp_discovery_expiry(discinfo_t *expiries, int number)
* Used by IrLAP to get the discovery info it needs when answering * Used by IrLAP to get the discovery info it needs when answering
* discovery requests by other devices. * discovery requests by other devices.
*/ */
discovery_t *irlmp_get_discovery_response() discovery_t *irlmp_get_discovery_response(void)
{ {
IRDA_DEBUG(4, "%s()\n", __FUNCTION__); IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
*/ */
static inline ssize_t static inline ssize_t
irnet_ctrl_write(irnet_socket * ap, irnet_ctrl_write(irnet_socket * ap,
const char * buf, const char __user *buf,
size_t count) size_t count)
{ {
char command[IRNET_MAX_COMMAND]; char command[IRNET_MAX_COMMAND];
...@@ -254,7 +254,7 @@ irnet_read_discovery_log(irnet_socket * ap, ...@@ -254,7 +254,7 @@ irnet_read_discovery_log(irnet_socket * ap,
static inline ssize_t static inline ssize_t
irnet_ctrl_read(irnet_socket * ap, irnet_ctrl_read(irnet_socket * ap,
struct file * file, struct file * file,
char * buf, char __user * buf,
size_t count) size_t count)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
...@@ -529,7 +529,7 @@ dev_irnet_close(struct inode * inode, ...@@ -529,7 +529,7 @@ dev_irnet_close(struct inode * inode,
*/ */
static ssize_t static ssize_t
dev_irnet_write(struct file * file, dev_irnet_write(struct file * file,
const char * buf, const char __user *buf,
size_t count, size_t count,
loff_t * ppos) loff_t * ppos)
{ {
...@@ -553,7 +553,7 @@ dev_irnet_write(struct file * file, ...@@ -553,7 +553,7 @@ dev_irnet_write(struct file * file,
*/ */
static ssize_t static ssize_t
dev_irnet_read(struct file * file, dev_irnet_read(struct file * file,
char * buf, char __user * buf,
size_t count, size_t count,
loff_t * ppos) loff_t * ppos)
{ {
...@@ -610,6 +610,7 @@ dev_irnet_ioctl(struct inode * inode, ...@@ -610,6 +610,7 @@ dev_irnet_ioctl(struct inode * inode,
irnet_socket * ap = (struct irnet_socket *) file->private_data; irnet_socket * ap = (struct irnet_socket *) file->private_data;
int err; int err;
int val; int val;
void __user *argp = (void __user *)arg;
DENTER(FS_TRACE, "(file=0x%p, ap=0x%p, cmd=0x%X)\n", DENTER(FS_TRACE, "(file=0x%p, ap=0x%p, cmd=0x%X)\n",
file, ap, cmd); file, ap, cmd);
...@@ -626,7 +627,7 @@ dev_irnet_ioctl(struct inode * inode, ...@@ -626,7 +627,7 @@ dev_irnet_ioctl(struct inode * inode,
{ {
/* Set discipline (should be N_SYNC_PPP or N_TTY) */ /* Set discipline (should be N_SYNC_PPP or N_TTY) */
case TIOCSETD: case TIOCSETD:
if(get_user(val, (int *) arg)) if(get_user(val, (int __user *)argp))
break; break;
if((val == N_SYNC_PPP) || (val == N_PPP)) if((val == N_SYNC_PPP) || (val == N_PPP))
{ {
...@@ -665,7 +666,7 @@ dev_irnet_ioctl(struct inode * inode, ...@@ -665,7 +666,7 @@ dev_irnet_ioctl(struct inode * inode,
case PPPIOCGCHAN: case PPPIOCGCHAN:
if(!ap->ppp_open) if(!ap->ppp_open)
break; break;
if(put_user(ppp_channel_index(&ap->chan), (int *) arg)) if(put_user(ppp_channel_index(&ap->chan), (int __user *)argp))
break; break;
DEBUG(FS_INFO, "Query channel.\n"); DEBUG(FS_INFO, "Query channel.\n");
err = 0; err = 0;
...@@ -673,7 +674,7 @@ dev_irnet_ioctl(struct inode * inode, ...@@ -673,7 +674,7 @@ dev_irnet_ioctl(struct inode * inode,
case PPPIOCGUNIT: case PPPIOCGUNIT:
if(!ap->ppp_open) if(!ap->ppp_open)
break; break;
if(put_user(ppp_unit_number(&ap->chan), (int *) arg)) if(put_user(ppp_unit_number(&ap->chan), (int __user *)argp))
break; break;
DEBUG(FS_INFO, "Query unit number.\n"); DEBUG(FS_INFO, "Query unit number.\n");
err = 0; err = 0;
...@@ -703,14 +704,14 @@ dev_irnet_ioctl(struct inode * inode, ...@@ -703,14 +704,14 @@ dev_irnet_ioctl(struct inode * inode,
/* Get termios */ /* Get termios */
case TCGETS: case TCGETS:
DEBUG(FS_INFO, "Get termios.\n"); DEBUG(FS_INFO, "Get termios.\n");
if(kernel_termios_to_user_termios((struct termios *)arg, &ap->termios)) if(kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios))
break; break;
err = 0; err = 0;
break; break;
/* Set termios */ /* Set termios */
case TCSETSF: case TCSETSF:
DEBUG(FS_INFO, "Set termios.\n"); DEBUG(FS_INFO, "Set termios.\n");
if(user_termios_to_kernel_termios(&ap->termios, (struct termios *) arg)) if(user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp))
break; break;
err = 0; err = 0;
break; break;
...@@ -743,7 +744,7 @@ dev_irnet_ioctl(struct inode * inode, ...@@ -743,7 +744,7 @@ dev_irnet_ioctl(struct inode * inode,
case FIONREAD: case FIONREAD:
DEBUG(FS_INFO, "FIONREAD\n"); DEBUG(FS_INFO, "FIONREAD\n");
val = 0; val = 0;
if(put_user(val, (int *) arg)) if(put_user(val, (int __user *)argp))
break; break;
err = 0; err = 0;
break; break;
...@@ -950,6 +951,7 @@ ppp_irnet_ioctl(struct ppp_channel * chan, ...@@ -950,6 +951,7 @@ ppp_irnet_ioctl(struct ppp_channel * chan,
int err; int err;
int val; int val;
u32 accm[8]; u32 accm[8];
void __user *argp = (void __user *)arg;
DENTER(PPP_TRACE, "(channel=0x%p, ap=0x%p, cmd=0x%X)\n", DENTER(PPP_TRACE, "(channel=0x%p, ap=0x%p, cmd=0x%X)\n",
chan, ap, cmd); chan, ap, cmd);
...@@ -963,12 +965,12 @@ ppp_irnet_ioctl(struct ppp_channel * chan, ...@@ -963,12 +965,12 @@ ppp_irnet_ioctl(struct ppp_channel * chan,
/* PPP flags */ /* PPP flags */
case PPPIOCGFLAGS: case PPPIOCGFLAGS:
val = ap->flags | ap->rbits; val = ap->flags | ap->rbits;
if(put_user(val, (int *) arg)) if(put_user(val, (int __user *) argp))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCSFLAGS: case PPPIOCSFLAGS:
if(get_user(val, (int *) arg)) if(get_user(val, (int __user *) argp))
break; break;
ap->flags = val & ~SC_RCV_BITS; ap->flags = val & ~SC_RCV_BITS;
ap->rbits = val & SC_RCV_BITS; ap->rbits = val & SC_RCV_BITS;
...@@ -977,32 +979,32 @@ ppp_irnet_ioctl(struct ppp_channel * chan, ...@@ -977,32 +979,32 @@ ppp_irnet_ioctl(struct ppp_channel * chan,
/* Async map stuff - all dummy to please pppd */ /* Async map stuff - all dummy to please pppd */
case PPPIOCGASYNCMAP: case PPPIOCGASYNCMAP:
if(put_user(ap->xaccm[0], (u32 *) arg)) if(put_user(ap->xaccm[0], (u32 __user *) argp))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCSASYNCMAP: case PPPIOCSASYNCMAP:
if(get_user(ap->xaccm[0], (u32 *) arg)) if(get_user(ap->xaccm[0], (u32 __user *) argp))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCGRASYNCMAP: case PPPIOCGRASYNCMAP:
if(put_user(ap->raccm, (u32 *) arg)) if(put_user(ap->raccm, (u32 __user *) argp))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCSRASYNCMAP: case PPPIOCSRASYNCMAP:
if(get_user(ap->raccm, (u32 *) arg)) if(get_user(ap->raccm, (u32 __user *) argp))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCGXASYNCMAP: case PPPIOCGXASYNCMAP:
if(copy_to_user((void *) arg, ap->xaccm, sizeof(ap->xaccm))) if(copy_to_user(argp, ap->xaccm, sizeof(ap->xaccm)))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCSXASYNCMAP: case PPPIOCSXASYNCMAP:
if(copy_from_user(accm, (void *) arg, sizeof(accm))) if(copy_from_user(accm, argp, sizeof(accm)))
break; break;
accm[2] &= ~0x40000000U; /* can't escape 0x5e */ accm[2] &= ~0x40000000U; /* can't escape 0x5e */
accm[3] |= 0x60000000U; /* must escape 0x7d, 0x7e */ accm[3] |= 0x60000000U; /* must escape 0x7d, 0x7e */
...@@ -1012,12 +1014,12 @@ ppp_irnet_ioctl(struct ppp_channel * chan, ...@@ -1012,12 +1014,12 @@ ppp_irnet_ioctl(struct ppp_channel * chan,
/* Max PPP frame size */ /* Max PPP frame size */
case PPPIOCGMRU: case PPPIOCGMRU:
if(put_user(ap->mru, (int *) arg)) if(put_user(ap->mru, (int __user *) argp))
break; break;
err = 0; err = 0;
break; break;
case PPPIOCSMRU: case PPPIOCSMRU:
if(get_user(val, (int *) arg)) if(get_user(val, (int __user *) argp))
break; break;
if(val < PPP_MRU) if(val < PPP_MRU)
val = PPP_MRU; val = PPP_MRU;
...@@ -1097,7 +1099,7 @@ void __exit ...@@ -1097,7 +1099,7 @@ void __exit
irnet_cleanup(void) irnet_cleanup(void)
{ {
irda_irnet_cleanup(); irda_irnet_cleanup();
return ppp_irnet_cleanup(); ppp_irnet_cleanup();
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
......
...@@ -66,11 +66,11 @@ static int ...@@ -66,11 +66,11 @@ static int
struct file *); struct file *);
static ssize_t static ssize_t
dev_irnet_write(struct file *, dev_irnet_write(struct file *,
const char *, const char __user *,
size_t, size_t,
loff_t *), loff_t *),
dev_irnet_read(struct file *, dev_irnet_read(struct file *,
char *, char __user *,
size_t, size_t,
loff_t *); loff_t *);
static unsigned int static unsigned int
......
...@@ -78,7 +78,7 @@ static int min_lap_keepalive_time = 100; /* 100us */ ...@@ -78,7 +78,7 @@ static int min_lap_keepalive_time = 100; /* 100us */
* us on that - Jean II */ * us on that - Jean II */
static int do_devname(ctl_table *table, int write, struct file *filp, static int do_devname(ctl_table *table, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
int ret; int ret;
......
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