1
0
Fork 0

[PATCH] m68k: dsp56k __user annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
hifive-unleashed-5.1
Al Viro 2006-01-12 01:06:31 -08:00 committed by Linus Torvalds
parent ab14caec7a
commit d85f6891aa
2 changed files with 16 additions and 15 deletions

View File

@ -165,7 +165,7 @@ static int dsp56k_reset(void)
return 0; return 0;
} }
static int dsp56k_upload(u_char *bin, int len) static int dsp56k_upload(u_char __user *bin, int len)
{ {
int i; int i;
u_char *p; u_char *p;
@ -199,7 +199,7 @@ static int dsp56k_upload(u_char *bin, int len)
return 0; return 0;
} }
static ssize_t dsp56k_read(struct file *file, char *buf, size_t count, static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
@ -225,10 +225,10 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
} }
case 2: /* 16 bit */ case 2: /* 16 bit */
{ {
short *data; short __user *data;
count /= 2; count /= 2;
data = (short*) buf; data = (short __user *) buf;
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE, handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
put_user(dsp56k_host_interface.data.w[1], data+n++)); put_user(dsp56k_host_interface.data.w[1], data+n++));
return 2*n; return 2*n;
@ -244,10 +244,10 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
} }
case 4: /* 32 bit */ case 4: /* 32 bit */
{ {
long *data; long __user *data;
count /= 4; count /= 4;
data = (long*) buf; data = (long __user *) buf;
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE, handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
put_user(dsp56k_host_interface.data.l, data+n++)); put_user(dsp56k_host_interface.data.l, data+n++));
return 4*n; return 4*n;
@ -262,7 +262,7 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
} }
} }
static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count, static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
@ -287,10 +287,10 @@ static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
} }
case 2: /* 16 bit */ case 2: /* 16 bit */
{ {
const short *data; const short __user *data;
count /= 2; count /= 2;
data = (const short *)buf; data = (const short __user *)buf;
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT, handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
get_user(dsp56k_host_interface.data.w[1], data+n++)); get_user(dsp56k_host_interface.data.w[1], data+n++));
return 2*n; return 2*n;
@ -306,10 +306,10 @@ static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
} }
case 4: /* 32 bit */ case 4: /* 32 bit */
{ {
const long *data; const long __user *data;
count /= 4; count /= 4;
data = (const long *)buf; data = (const long __user *)buf;
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT, handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
get_user(dsp56k_host_interface.data.l, data+n++)); get_user(dsp56k_host_interface.data.l, data+n++));
return 4*n; return 4*n;
@ -328,6 +328,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int dev = iminor(inode) & 0x0f; int dev = iminor(inode) & 0x0f;
void __user *argp = (void __user *)arg;
switch(dev) switch(dev)
{ {
@ -336,9 +337,9 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
switch(cmd) { switch(cmd) {
case DSP56K_UPLOAD: case DSP56K_UPLOAD:
{ {
char *bin; char __user *bin;
int r, len; int r, len;
struct dsp56k_upload *binary = (struct dsp56k_upload *) arg; struct dsp56k_upload __user *binary = argp;
if(get_user(len, &binary->len) < 0) if(get_user(len, &binary->len) < 0)
return -EFAULT; return -EFAULT;
@ -372,7 +373,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
case DSP56K_HOST_FLAGS: case DSP56K_HOST_FLAGS:
{ {
int dir, out, status; int dir, out, status;
struct dsp56k_host_flags *hf = (struct dsp56k_host_flags*) arg; struct dsp56k_host_flags __user *hf = argp;
if(get_user(dir, &hf->dir) < 0) if(get_user(dir, &hf->dir) < 0)
return -EFAULT; return -EFAULT;

View File

@ -13,7 +13,7 @@
/* Used for uploading DSP binary code */ /* Used for uploading DSP binary code */
struct dsp56k_upload { struct dsp56k_upload {
int len; int len;
char *bin; char __user *bin;
}; };
/* For the DSP host flags */ /* For the DSP host flags */