@@ -249,11 +249,11 @@ static loff_t jsf_lseek(struct file * file, loff_t offset, int orig)
249249/*
250250 * OS SIMM Cannot be read in other size but a 32bits word.
251251 */
252- static ssize_t jsf_read (struct file * file , char * buf ,
252+ static ssize_t jsf_read (struct file * file , char __user * buf ,
253253 size_t togo , loff_t * ppos )
254254{
255255 unsigned long p = * ppos ;
256- char * tmp = buf ;
256+ char __user * tmp = buf ;
257257
258258 union byte4 {
259259 char s [4 ];
@@ -305,7 +305,7 @@ static ssize_t jsf_read(struct file * file, char * buf,
305305 return tmp - buf ;
306306}
307307
308- static ssize_t jsf_write (struct file * file , const char * buf ,
308+ static ssize_t jsf_write (struct file * file , const char __user * buf ,
309309 size_t count , loff_t * ppos )
310310{
311311 return - ENOSPC ;
@@ -356,24 +356,24 @@ static int jsf_ioctl_erase(unsigned long arg)
356356 * Program a block of flash.
357357 * Very simple because we can do it byte by byte anyway.
358358 */
359- static int jsf_ioctl_program (unsigned long arg )
359+ static int jsf_ioctl_program (void __user * arg )
360360{
361361 struct jsflash_program_arg abuf ;
362- char * uptr ;
362+ char __user * uptr ;
363363 unsigned long p ;
364364 unsigned int togo ;
365365 union {
366366 unsigned int n ;
367367 char s [4 ];
368368 } b ;
369369
370- if (copy_from_user (& abuf , ( char * ) arg , JSFPRGSZ ))
370+ if (copy_from_user (& abuf , arg , JSFPRGSZ ))
371371 return - EFAULT ;
372372 p = abuf .off ;
373373 togo = abuf .size ;
374374 if ((togo & 3 ) || (p & 3 )) return - EINVAL ;
375375
376- uptr = (char * ) (unsigned long ) abuf .data ;
376+ uptr = (char __user * ) (unsigned long ) abuf .data ;
377377 while (togo != 0 ) {
378378 togo -= 4 ;
379379 if (copy_from_user (& b .s [0 ], uptr , 4 ))
@@ -390,19 +390,20 @@ static int jsf_ioctl(struct inode *inode, struct file *f, unsigned int cmd,
390390 unsigned long arg )
391391{
392392 int error = - ENOTTY ;
393+ void __user * argp = (void __user * )arg ;
393394
394395 if (!capable (CAP_SYS_ADMIN ))
395396 return - EPERM ;
396397 switch (cmd ) {
397398 case JSFLASH_IDENT :
398- if (copy_to_user (( void * ) arg , & jsf0 .id , JSFIDSZ ))
399+ if (copy_to_user (argp , & jsf0 .id , JSFIDSZ ))
399400 return - EFAULT ;
400401 break ;
401402 case JSFLASH_ERASE :
402403 error = jsf_ioctl_erase (arg );
403404 break ;
404405 case JSFLASH_PROGRAM :
405- error = jsf_ioctl_program (arg );
406+ error = jsf_ioctl_program (argp );
406407 break ;
407408 }
408409
0 commit comments