Commit d85f6891aa143bed92590e10e210e7e102bbb2a1

Authored by Al Viro
Committed by Linus Torvalds
1 parent ab14caec7a

[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>

Showing 2 changed files with 16 additions and 15 deletions Side-by-side Diff

drivers/char/dsp56k.c
... ... @@ -165,7 +165,7 @@
165 165 return 0;
166 166 }
167 167  
168   -static int dsp56k_upload(u_char *bin, int len)
  168 +static int dsp56k_upload(u_char __user *bin, int len)
169 169 {
170 170 int i;
171 171 u_char *p;
... ... @@ -199,7 +199,7 @@
199 199 return 0;
200 200 }
201 201  
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,
203 203 loff_t *ppos)
204 204 {
205 205 struct inode *inode = file->f_dentry->d_inode;
206 206  
... ... @@ -225,10 +225,10 @@
225 225 }
226 226 case 2: /* 16 bit */
227 227 {
228   - short *data;
  228 + short __user *data;
229 229  
230 230 count /= 2;
231   - data = (short*) buf;
  231 + data = (short __user *) buf;
232 232 handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
233 233 put_user(dsp56k_host_interface.data.w[1], data+n++));
234 234 return 2*n;
235 235  
... ... @@ -244,10 +244,10 @@
244 244 }
245 245 case 4: /* 32 bit */
246 246 {
247   - long *data;
  247 + long __user *data;
248 248  
249 249 count /= 4;
250   - data = (long*) buf;
  250 + data = (long __user *) buf;
251 251 handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_RECEIVE,
252 252 put_user(dsp56k_host_interface.data.l, data+n++));
253 253 return 4*n;
... ... @@ -262,7 +262,7 @@
262 262 }
263 263 }
264 264  
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,
266 266 loff_t *ppos)
267 267 {
268 268 struct inode *inode = file->f_dentry->d_inode;
269 269  
... ... @@ -287,10 +287,10 @@
287 287 }
288 288 case 2: /* 16 bit */
289 289 {
290   - const short *data;
  290 + const short __user *data;
291 291  
292 292 count /= 2;
293   - data = (const short *)buf;
  293 + data = (const short __user *)buf;
294 294 handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
295 295 get_user(dsp56k_host_interface.data.w[1], data+n++));
296 296 return 2*n;
297 297  
... ... @@ -306,10 +306,10 @@
306 306 }
307 307 case 4: /* 32 bit */
308 308 {
309   - const long *data;
  309 + const long __user *data;
310 310  
311 311 count /= 4;
312   - data = (const long *)buf;
  312 + data = (const long __user *)buf;
313 313 handshake(count, dsp56k.maxio, dsp56k.timeout, DSP56K_TRANSMIT,
314 314 get_user(dsp56k_host_interface.data.l, data+n++));
315 315 return 4*n;
... ... @@ -328,6 +328,7 @@
328 328 unsigned int cmd, unsigned long arg)
329 329 {
330 330 int dev = iminor(inode) & 0x0f;
  331 + void __user *argp = (void __user *)arg;
331 332  
332 333 switch(dev)
333 334 {
334 335  
... ... @@ -336,9 +337,9 @@
336 337 switch(cmd) {
337 338 case DSP56K_UPLOAD:
338 339 {
339   - char *bin;
  340 + char __user *bin;
340 341 int r, len;
341   - struct dsp56k_upload *binary = (struct dsp56k_upload *) arg;
  342 + struct dsp56k_upload __user *binary = argp;
342 343  
343 344 if(get_user(len, &binary->len) < 0)
344 345 return -EFAULT;
... ... @@ -372,7 +373,7 @@
372 373 case DSP56K_HOST_FLAGS:
373 374 {
374 375 int dir, out, status;
375   - struct dsp56k_host_flags *hf = (struct dsp56k_host_flags*) arg;
  376 + struct dsp56k_host_flags __user *hf = argp;
376 377  
377 378 if(get_user(dir, &hf->dir) < 0)
378 379 return -EFAULT;
include/asm-m68k/dsp56k.h
... ... @@ -13,7 +13,7 @@
13 13 /* Used for uploading DSP binary code */
14 14 struct dsp56k_upload {
15 15 int len;
16   - char *bin;
  16 + char __user *bin;
17 17 };
18 18  
19 19 /* For the DSP host flags */