Skip to content

Commit d85f689

Browse files
Al ViroLinus Torvalds
authored andcommitted
[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>
1 parent ab14cae commit d85f689

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

‎drivers/char/dsp56k.c‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static int dsp56k_reset(void)
165165
return 0;
166166
}
167167

168-
static int dsp56k_upload(u_char *bin, int len)
168+
static int dsp56k_upload(u_char __user *bin, int len)
169169
{
170170
int i;
171171
u_char *p;
@@ -199,7 +199,7 @@ static int dsp56k_upload(u_char *bin, int len)
199199
return 0;
200200
}
201201

202-
static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
202+
static ssize_t dsp56k_read(struct file *file, char __user *buf, size_t count,
203203
loff_t *ppos)
204204
{
205205
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,
225225
}
226226
case 2: /* 16 bit */
227227
{
228-
short *data;
228+
short __user *data;
229229

230230
count /= 2;
231-
data = (short*) buf;
231+
data = (short __user *) buf;
232232
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
233233
put_user(dsp56k_host_interface.data.w[1], data+n++));
234234
return 2*n;
@@ -244,10 +244,10 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
244244
}
245245
case 4: /* 32 bit */
246246
{
247-
long *data;
247+
long __user *data;
248248

249249
count /= 4;
250-
data = (long*) buf;
250+
data = (long __user *) buf;
251251
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
252252
put_user(dsp56k_host_interface.data.l, data+n++));
253253
return 4*n;
@@ -262,7 +262,7 @@ static ssize_t dsp56k_read(struct file *file, char *buf, size_t count,
262262
}
263263
}
264264

265-
static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
265+
static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t count,
266266
loff_t *ppos)
267267
{
268268
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,
287287
}
288288
case 2: /* 16 bit */
289289
{
290-
const short *data;
290+
const short __user *data;
291291

292292
count /= 2;
293-
data = (const short *)buf;
293+
data = (const short __user *)buf;
294294
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
295295
get_user(dsp56k_host_interface.data.w[1], data+n++));
296296
return 2*n;
@@ -306,10 +306,10 @@ static ssize_t dsp56k_write(struct file *file, const char *buf, size_t count,
306306
}
307307
case 4: /* 32 bit */
308308
{
309-
const long *data;
309+
const long __user *data;
310310

311311
count /= 4;
312-
data = (const long *)buf;
312+
data = (const long __user *)buf;
313313
handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
314314
get_user(dsp56k_host_interface.data.l, data+n++));
315315
return 4*n;
@@ -328,6 +328,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
328328
unsigned int cmd, unsigned long arg)
329329
{
330330
int dev = iminor(inode) & 0x0f;
331+
void __user *argp = (void __user *)arg;
331332

332333
switch(dev)
333334
{
@@ -336,9 +337,9 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
336337
switch(cmd) {
337338
case DSP56K_UPLOAD:
338339
{
339-
char *bin;
340+
char __user *bin;
340341
int r, len;
341-
struct dsp56k_upload *binary = (struct dsp56k_upload *) arg;
342+
struct dsp56k_upload __user *binary = argp;
342343

343344
if(get_user(len, &binary->len) < 0)
344345
return -EFAULT;
@@ -372,7 +373,7 @@ static int dsp56k_ioctl(struct inode *inode, struct file *file,
372373
case DSP56K_HOST_FLAGS:
373374
{
374375
int dir, out, status;
375-
struct dsp56k_host_flags *hf = (struct dsp56k_host_flags*) arg;
376+
struct dsp56k_host_flags __user *hf = argp;
376377

377378
if(get_user(dir, &hf->dir) < 0)
378379
return -EFAULT;

‎include/asm-m68k/dsp56k.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/* Used for uploading DSP binary code */
1414
struct dsp56k_upload {
1515
int len;
16-
char *bin;
16+
char __user *bin;
1717
};
1818

1919
/* For the DSP host flags */

0 commit comments

Comments
 (0)