sparse: __user annotations for s390 drivers
Subsystems (6)
PATCH 1/1 sparse: __user annotations for s390 drivers
This should catch almost all s390 device drivers
===== arch/s390/appldata/appldata_base.c 1.3 vs edited =====
arch/s390/appldata/appldata_base.c +9 -7
@@ -85,9 +85,10 @@*/ static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH ] ="appldata" ;static int appldata_timer_handler (ctl_table *ctl,int write,struct file *filp, -void *buffer,size_t *lenp); +void __user *buffer,size_t *lenp);static int appldata_interval_handler (ctl_table *ctl,int write, -struct file *filp,void *buffer, +struct file *filp, +void __user *buffer,size_t *lenp);static struct ctl_table_header *appldata_sysctl_header;
@@ -192,7 +193,8 @@* wrapper function for mod_virt_timer(), because smp_call_function_on() * accepts only one parameter. */ -static void appldata_mod_vtimer_wrap (struct appldata_mod_vtimer_args *args) { +static void appldata_mod_vtimer_wrap (void *p) { +struct appldata_mod_vtimer_args *args = p;mod_virt_timer (args->timer, args->expires); }
@@ -252,7 +254,7 @@*/ static int appldata_timer_handler (ctl_table *ctl,int write,struct file *filp, -void *buffer,size_t *lenp) +void __user *buffer,size_t *lenp) {int len, i;char buf[2 ];
@@ -309,7 +311,7 @@*/ static int appldata_interval_handler (ctl_table *ctl,int write,struct file *filp, -void *buffer,size_t *lenp) +void __user *buffer,size_t *lenp) {int len, i, interval;char buf[16 ];
@@ -347,7 +349,7 @@ appldata_mod_vtimer_args.expires = per_cpu_interval;smp_call_function_on ( - (void *) appldata_mod_vtimer_wrap, + appldata_mod_vtimer_wrap, &appldata_mod_vtimer_args,0 ,1 , i); }
@@ -370,7 +372,7 @@*/ static int appldata_generic_handler (ctl_table *ctl,int write,struct file *filp, -void *buffer,size_t *lenp) +void __user *buffer,size_t *lenp) {struct appldata_ops *ops =NULL , *tmp_ops;int rc, len, found;
===== drivers/s390/block/dasd_cmb.c 1.1 vs edited =====
drivers/s390/block/dasd_cmb.c +2 -2
@@ -58,7 +58,7 @@ dasd_ioctl_readall_cmb(struct block_device *bdev, int no, long args) { struct dasd_device *device; -struct cmbdata *__user udata; +struct cmbdata __user *udata;struct cmbdata data;size_t size;int ret;
@@ -66,7 +66,7 @@ device = bdev->bd_disk->private_data;if (!device)return -EINVAL ; - udata = (void *) args; + udata = (void __user *) args; size =_IOC_SIZE (no);if (!access_ok (VERIFY_WRITE , udata, size))
===== drivers/s390/block/dasd_eckd.c 1.28 vs edited =====
drivers/s390/block/dasd_eckd.c +5 -5
@@ -1289,7 +1289,7 @@/* Prepare for Read Subsystem Data */ prssdp = (struct dasd_psf_prssd_data *) cqr->data; stats = (struct dasd_rssd_perf_stats_t *) (prssdp +1 ); - rc =copy_to_user ((long *) args, (long *) stats, + rc =copy_to_user ((long __user *) args, (long *) stats,sizeof (struct dasd_rssd_perf_stats_t )); }dasd_sfree_request (cqr, cqr->device);
@@ -1319,10 +1319,10 @@ private = (struct dasd_eckd_private *) device->private; attrib = private->attrib; - - rc =copy_to_user ((long *) args, (long *) &attrib, + + rc =copy_to_user ((long __user *) args, (long *) &attrib,sizeof (struct attrib_data_t )); - +return rc; }
@@ -1346,7 +1346,7 @@if (device ==NULL )return -ENODEV ; -if (copy_from_user (&attrib, (void *) args, +if (copy_from_user (&attrib, (void __user *) args,sizeof (struct attrib_data_t ))) {return -EFAULT ; }
===== drivers/s390/block/dasd_ioctl.c 1.21 vs edited =====
drivers/s390/block/dasd_ioctl.c +7 -7
@@ -120,7 +120,7 @@ dasd_ioctl_api_version(struct block_device *bdev, int no, long args) { int ver = DASD_API_VERSION; -return put_user (ver, (int *) args); +return put_user (ver, (int __user *) args); }/*
@@ -305,7 +305,7 @@return -ENODEV ;if (test_bit (DASD_FLAG_RO , &device->flags))return -EROFS ; -if (copy_from_user (&fdata, (void *) args, +if (copy_from_user (&fdata, (void __user *) args,sizeof (struct format_data_t )))return -EFAULT ;if (bdev != bdev->bd_contains) {
@@ -348,7 +348,7 @@if (device ==NULL )return -ENODEV ; -if (copy_to_user ((long *) args, (long *) &device->profile, +if (copy_to_user ((long __user *) args, (long *) &device->profile,sizeof (struct dasd_profile_info_t )))return -EFAULT ;return 0 ;
@@ -441,9 +441,9 @@spin_unlock_irqrestore (get_ccwdev_lock (device->cdev), flags); } - + rc =0 ; -if (copy_to_user ((long *) args, (long *) dasd_info, +if (copy_to_user ((long __user *) args, (long *) dasd_info, ((no == (unsigned int )BIODASDINFO2 ) ?sizeof (struct dasd_information2_t ) :sizeof (struct dasd_information_t ))))
@@ -466,7 +466,7 @@if (bdev != bdev->bd_contains)// ro setting is not allowed for partitions return -EINVAL ; -if (get_user (intval, (int *) args)) +if (get_user (intval, (int __user *) args))return -EFAULT ; device = bdev->bd_disk->private_data;if (device ==NULL )
@@ -499,7 +499,7 @@ geo = (struct hd_geometry ) {}; device->discipline->fill_geometry (device, &geo); geo.start =get_start_sect (bdev) >> device->s2b_shift; -if (copy_to_user ((struct hd_geometry *) args, &geo, +if (copy_to_user ((struct hd_geometry __user *) args, &geo,sizeof (struct hd_geometry )))return -EFAULT ;
===== drivers/s390/block/dasd_proc.c 1.16 vs edited =====
drivers/s390/block/dasd_proc.c +2 -2
@@ -30,7 +30,7 @@static struct proc_dir_entry *dasd_statistics_entry =NULL ;static inline char * -dasd_get_user_string (const char *user_buf,size_t user_len) +dasd_get_user_string (const char __user *user_buf,size_t user_len) {char *buffer;
@@ -239,7 +239,7 @@ }static int -dasd_statistics_write (struct file *file,const char *user_buf, +dasd_statistics_write (struct file *file,const char __user *user_buf,unsigned long user_len,void *data) {#ifdef CONFIG_DASD_PROFILE
===== drivers/s390/block/xpram.c 1.47 vs edited =====
drivers/s390/block/xpram.c +5 -5
@@ -155,7 +155,7 @@ {int cc; - __asm__ __volatile( + __asm__ __volatile__ (" lhi %0,2\n" /* return unused cc 2 if pgin traps */ " .insn rre,0xb22e0000,%1,%2\n" /* pgin %1,%2 */ "0: ipm %0\n"
@@ -203,7 +203,7 @@ {int cc; - __asm__ __volatile( + __asm__ __volatile__ (" lhi %0,2\n" /* return unused cc 2 if pgout traps */ " .insn rre,0xb22f0000,%1,%2\n" /* pgout %1,%2 */ "0: ipm %0\n"
@@ -332,16 +332,16 @@static int xpram_ioctl (struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg) { -struct hd_geometry *geo; +struct hd_geometry __user *geo;unsigned long size; -if (cmd !=HDIO_GETGEO ) +if (cmd !=HDIO_GETGEO )return -EINVAL ;/* * get geometry: we have to fake one... trim the size to a * multiple of 64 (32k): tell we have 16 sectors, 4 heads, * whatever cylinders. Tell also that data starts at sector. 4. */ - geo = (struct hd_geometry *) arg; + geo = (struct hd_geometry __user *) arg; size = (xpram_pages *8 ) & ~0x3f ;put_user (size >>6 , &geo->cylinders);put_user (4 , &geo->heads);
===== drivers/s390/char/con3215.c 1.26 vs edited =====
drivers/s390/char/con3215.c +2 -1
@@ -1002,7 +1002,8 @@ ret =0 ;while (count >0 ) { length = count <80 ? count :80 ; - length -=copy_from_user (raw->ubuffer, buf, length); + length -=copy_from_user (raw->ubuffer, + (const unsigned char __user *)buf, length);if (length ==0 ) {if (!ret) ret = -EFAULT ;
===== drivers/s390/char/keyboard.c 1.2 vs edited =====
drivers/s390/char/keyboard.c +11 -8
@@ -338,7 +338,7 @@* Ioctl stuff. */ static int -do_kdsk_ioctl (struct kbd_data *kbd,struct kbentry *user_kbe, +do_kdsk_ioctl (struct kbd_data *kbd,struct kbentry __user *user_kbe,int cmd,int perm) {struct kbentry tmp;
@@ -410,7 +410,7 @@ }static int -do_kdgkb_ioctl (struct kbd_data *kbd,struct kbsentry *u_kbs, +do_kdgkb_ioctl (struct kbd_data *kbd,struct kbsentry __user *u_kbs,int cmd,int perm) {unsigned char kb_func;
@@ -464,9 +464,12 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, unsigned int cmd, unsigned long arg) { - struct kbdiacrs *a; + struct kbdiacrs __user *a; +void __user *argp;int ct, perm; + argp = (void __user *)arg; +/* * To have permissions to do most of the vt ioctls, we either have * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
@@ -474,15 +477,15 @@ perm = current->signal->tty == kbd->tty ||capable (CAP_SYS_TTY_CONFIG );switch (cmd) {case KDGKBTYPE : -return put_user (KB_101 , (char *) arg); +return put_user (KB_101 , (char __user *)argp);case KDGKBENT :case KDSKBENT : -return do_kdsk_ioctl (kbd, (struct kbentry *)arg, cmd, perm); +return do_kdsk_ioctl (kbd, argp, cmd, perm);case KDGKBSENT :case KDSKBSENT : -return do_kdgkb_ioctl (kbd, (struct kbsentry *)arg, cmd, perm); +return do_kdgkb_ioctl (kbd, argp, cmd, perm);case KDGKBDIACR : - a = (struct kbdiacrs *) arg; + a = argp;if (put_user (kbd->accent_table_size, &a->kb_cnt))return -EFAULT ;
@@ -492,7 +495,7 @@return -EFAULT ;return 0 ;case KDSKBDIACR : - a = (struct kbdiacrs *) arg; + a = argp;if (!perm)return -EPERM ;if (get_user (ct, &a->kb_cnt))
===== drivers/s390/char/sclp_tty.c 1.16 vs edited =====
drivers/s390/char/sclp_tty.c +17 -16
@@ -112,46 +112,46 @@switch (cmd) {case TIOCSCLPSHTAB :/* set width of horizontal tab */ -if (get_user (sclp_ioctls.htab, (unsigned short *) arg)) +if (get_user (sclp_ioctls.htab, (unsigned short __user *) arg)) rc = -EFAULT ;else check =1 ;break ;case TIOCSCLPGHTAB :/* get width of horizontal tab */ -if (put_user (sclp_ioctls.htab, (unsigned short *) arg)) +if (put_user (sclp_ioctls.htab, (unsigned short __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSECHO :/* enable/disable echo of input */ -if (get_user (sclp_ioctls.echo, (unsigned char *) arg)) +if (get_user (sclp_ioctls.echo, (unsigned char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPGECHO :/* Is echo of input enabled ? */ -if (put_user (sclp_ioctls.echo, (unsigned char *) arg)) +if (put_user (sclp_ioctls.echo, (unsigned char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSCOLS :/* set number of columns for output */ -if (get_user (sclp_ioctls.columns, (unsigned short *) arg)) +if (get_user (sclp_ioctls.columns, (unsigned short __user *) arg)) rc = -EFAULT ;else check =1 ;break ;case TIOCSCLPGCOLS :/* get number of columns for output */ -if (put_user (sclp_ioctls.columns, (unsigned short *) arg)) +if (put_user (sclp_ioctls.columns, (unsigned short __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSNL :/* enable/disable writing without final new line character */ -if (get_user (sclp_ioctls.final_nl, (signed char *) arg)) +if (get_user (sclp_ioctls.final_nl, (signed char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPGNL :/* Is writing without final new line character enabled ? */ -if (put_user (sclp_ioctls.final_nl, (signed char *) arg)) +if (put_user (sclp_ioctls.final_nl, (signed char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSOBUF :
@@ -160,7 +160,7 @@* up to next 4kB boundary and stored as number of SCCBs * (4kB Buffers) limitation: 256 x 4kB */ -if (get_user (obuf, (unsigned int *) arg) ==0 ) { +if (get_user (obuf, (unsigned int __user *) arg) ==0 ) {if (obuf &0xFFF ) sclp_ioctls.max_sccb = (obuf >>12 ) +1 ;else
@@ -171,22 +171,22 @@case TIOCSCLPGOBUF :/* get the maximum buffers size for output */ obuf = sclp_ioctls.max_sccb <<12 ; -if (put_user (obuf, (unsigned int *) arg)) +if (put_user (obuf, (unsigned int __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPGKBUF :/* get the number of buffers got from kernel at startup */ -if (put_user (sclp_ioctls.kmem_sccb, (unsigned short *) arg)) +if (put_user (sclp_ioctls.kmem_sccb, (unsigned short __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSCASE :/* enable/disable conversion from upper to lower case */ -if (get_user (sclp_ioctls.tolower, (unsigned char *) arg)) +if (get_user (sclp_ioctls.tolower, (unsigned char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPGCASE :/* Is conversion from upper to lower case of input enabled? */ -if (put_user (sclp_ioctls.tolower, (unsigned char *) arg)) +if (put_user (sclp_ioctls.tolower, (unsigned char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSDELIM :
@@ -194,7 +194,7 @@* set special character used for separating upper and * lower case, 0x00 disables this feature */ -if (get_user (sclp_ioctls.delim, (unsigned char *) arg)) +if (get_user (sclp_ioctls.delim, (unsigned char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPGDELIM :
@@ -202,7 +202,7 @@* get special character used for separating upper and * lower case, 0x00 disables this feature */ -if (put_user (sclp_ioctls.delim, (unsigned char *) arg)) +if (put_user (sclp_ioctls.delim, (unsigned char __user *) arg)) rc = -EFAULT ;break ;case TIOCSCLPSINIT :
@@ -415,7 +415,8 @@while (count >0 ) { length = count <SCLP_TTY_BUF_SIZE ? count :SCLP_TTY_BUF_SIZE ; - length -=copy_from_user (sclp_tty_chars, buf, length); + length -=copy_from_user (sclp_tty_chars, + (const unsigned char __user *)buf, length);if (length ==0 ) {if (!ret) ret = -EFAULT ;
===== drivers/s390/char/sclp_vt220.c 1.2 vs edited =====
drivers/s390/char/sclp_vt220.c +2 -1
@@ -490,7 +490,8 @@while (count >0 ) { length = count <SCLP_VT220_BUF_SIZE ? count :SCLP_VT220_BUF_SIZE ; - length -=copy_from_user (tty->driver_data, buf, length); + length -=copy_from_user (tty->driver_data, + (const unsigned char __user *)buf, length);if (length ==0 ) {if (!ret)return -EFAULT ;
===== drivers/s390/char/tape_34xx.c 1.6 vs edited =====
drivers/s390/char/tape_34xx.c +1 -1
@@ -885,7 +885,7 @@if (cmd ==TAPE390_DISPLAY ) {struct display_struct disp; -if (copy_from_user (&disp, (char *) arg,sizeof (disp)) !=0 ) +if (copy_from_user (&disp, (char __user *) arg,sizeof (disp)) !=0 )return -EFAULT ;return tape_std_display (device, &disp);
===== drivers/s390/char/tape_char.c 1.9 vs edited =====
drivers/s390/char/tape_char.c +7 -7
@@ -29,8 +29,8 @@/* * file operation structure for tape character frontend */ -static ssize_t tapechar_read (struct file *,char *,size_t ,loff_t *); -static ssize_t tapechar_write (struct file *,const char *,size_t ,loff_t *); +static ssize_t tapechar_read (struct file *,char __user *,size_t ,loff_t *); +static ssize_t tapechar_write (struct file *,const char __user *,size_t ,loff_t *);static int tapechar_open (struct inode *,struct file *);static int tapechar_release (struct inode *,struct file *); static int tapechar_ioctl(struct inode *, struct file *, unsigned int,
@@ -134,7 +134,7 @@* Tape device read function */ ssize_t -tapechar_read (struct file *filp,char *data,size_t count,loff_t *ppos) +tapechar_read (struct file *filp,char __user *data,size_t count,loff_t *ppos) {struct tape_device *device;struct tape_request *request;
@@ -208,7 +208,7 @@* Tape device write function */ ssize_t -tapechar_write (struct file *filp,const char *data,size_t count,loff_t *ppos) +tapechar_write (struct file *filp,const char __user *data,size_t count,loff_t *ppos) {struct tape_device *device;struct tape_request *request;
@@ -389,7 +389,7 @@if (no ==MTIOCTOP ) {struct mtop op; -if (copy_from_user (&op, (char *) data,sizeof (op)) !=0 ) +if (copy_from_user (&op, (char __user *) data,sizeof (op)) !=0 )return -EFAULT ;if (op.mt_count <0 )return -EINVAL ;
@@ -436,7 +436,7 @@if (rc <0 )return rc; pos.mt_blkno = rc; -if (copy_to_user ((char *) data, &pos,sizeof (pos)) !=0 ) +if (copy_to_user ((char __user *) data, &pos,sizeof (pos)) !=0 )return -EFAULT ;return 0 ; }
@@ -466,7 +466,7 @@ get.mt_blkno = rc; } -if (copy_to_user ((char *) data, &get,sizeof (get)) !=0 ) +if (copy_to_user ((char __user *) data, &get,sizeof (get)) !=0 )return -EFAULT ;return 0 ;
===== drivers/s390/cio/blacklist.c 1.8 vs edited =====
drivers/s390/cio/blacklist.c +1 -1
@@ -308,7 +308,7 @@return len; } -static int cio_ignore_write (struct file *file,const char *user_buf, +static int cio_ignore_write (struct file *file,const char __user *user_buf,unsigned long user_len,void *data) {char *buf;
===== drivers/s390/cio/device_fsm.c 1.19 vs edited =====
drivers/s390/cio/device_fsm.c +93 -93
196 lines not on this page · raw message
===== drivers/s390/crypto/z90crypt.h 1.1 vs edited =====
drivers/s390/crypto/z90crypt.h +11 -11
@@ -46,12 +46,12 @@* - length(n_modulus) = inputdatalength */ struct ica_rsa_modexpo { -char * inputdata; +char __user * inputdata;unsigned int inputdatalength; -char * outputdata; +char __user * outputdata;unsigned int outputdatalength; -char * b_key; -char * n_modulus; +char __user * b_key; +char __user * n_modulus; };/**
@@ -69,15 +69,15 @@* - length(u_mult_inv) = inputdatalength/2 + 8 */ struct ica_rsa_modexpo_crt { -char * inputdata; +char __user * inputdata;unsigned int inputdatalength; -char * outputdata; +char __user * outputdata;unsigned int outputdatalength; -char * bp_key; -char * bq_key; -char * np_prime; -char * nq_prime; -char * u_mult_inv; +char __user * bp_key; +char __user * bq_key; +char __user * np_prime; +char __user * nq_prime; +char __user * u_mult_inv; };#define Z90_IOCTL_MAGIC 'z' // NOTE: Need to allocate from linux folks
===== drivers/s390/crypto/z90main.c 1.1 vs edited =====
drivers/s390/crypto/z90main.c +34 -31
228 lines not on this page · raw message
===== drivers/s390/net/ctctty.c 1.24 vs edited =====
drivers/s390/net/ctctty.c +8 -7
@@ -515,7 +515,8 @@ }skb_reserve (skb, skb_res);if (from_user) -copy_from_user (skb_put (skb, c), buf, c); +copy_from_user (skb_put (skb, c), + (const u_char __user *)buf, c);else memcpy (skb_put (skb, c), buf, c);skb_queue_tail (&info->tx_queue, skb);
@@ -640,7 +641,7 @@* allows RS485 driver to be written in user space. */ static int -ctc_tty_get_lsr_info (ctc_tty_info * info,uint * value) +ctc_tty_get_lsr_info (ctc_tty_info * info,uint __user *value) {u_char status;uint result;
@@ -650,7 +651,7 @@ status = info->lsr;spin_unlock_irqrestore (&ctc_tty_lock, flags); result = ((status &UART_LSR_TEMT ) ?TIOCSER_TEMT :0 ); -put_user (result, (uint *) value); +put_user (result, value);return 0 ; }
@@ -743,14 +744,14 @@printk (KERN_DEBUG "%s%d ioctl TIOCGSOFTCAR\n" ,CTC_TTY_NAME , info->line);#endif - error =put_user (C_CLOCAL (tty) ?1 :0 , (ulong *) arg); + error =put_user (C_CLOCAL (tty) ?1 :0 , (ulong __user *) arg);return error;case TIOCSSOFTCAR :#ifdef CTC_DEBUG_MODEM_IOCTL printk (KERN_DEBUG "%s%d ioctl TIOCSSOFTCAR\n" ,CTC_TTY_NAME , info->line);#endif - error =get_user (arg, (ulong *) arg); + error =get_user (arg, (ulong __user *) arg);if (error)return error; tty->termios->c_cflag =
@@ -762,11 +763,11 @@printk (KERN_DEBUG "%s%d ioctl TIOCSERGETLSR\n" ,CTC_TTY_NAME , info->line);#endif - error =verify_area (VERIFY_WRITE , (void *) arg,sizeof (uint)); + error =verify_area (VERIFY_WRITE , (void __user *) arg,sizeof (uint));if (error)return error;else -return ctc_tty_get_lsr_info (info, (uint *) arg); +return ctc_tty_get_lsr_info (info, (uint __user *) arg);default :#ifdef CTC_DEBUG_MODEM_IOCTL printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on %s%d\n", cmd,