aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/ch.c27
-rw-r--r--include/linux/chio.h2
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 13ecd0c47404..da6e51c7fe69 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -560,7 +560,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem,
560 return result; 560 return result;
561} 561}
562 562
563static int ch_gstatus(scsi_changer *ch, int type, unsigned char *dest) 563static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
564{ 564{
565 int retval = 0; 565 int retval = 0;
566 u_char data[16]; 566 u_char data[16];
@@ -634,6 +634,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
634{ 634{
635 scsi_changer *ch = file->private_data; 635 scsi_changer *ch = file->private_data;
636 int retval; 636 int retval;
637 void __user *argp = (void __user *)arg;
637 638
638 switch (cmd) { 639 switch (cmd) {
639 case CHIOGPARAMS: 640 case CHIOGPARAMS:
@@ -646,7 +647,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
646 params.cp_nportals = ch->counts[CHET_IE]; 647 params.cp_nportals = ch->counts[CHET_IE];
647 params.cp_ndrives = ch->counts[CHET_DT]; 648 params.cp_ndrives = ch->counts[CHET_DT];
648 649
649 if (copy_to_user((void *) arg, &params, sizeof(params))) 650 if (copy_to_user(argp, &params, sizeof(params)))
650 return -EFAULT; 651 return -EFAULT;
651 return 0; 652 return 0;
652 } 653 }
@@ -671,7 +672,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
671 vparams.cvp_n4 = ch->counts[CHET_V4]; 672 vparams.cvp_n4 = ch->counts[CHET_V4];
672 strncpy(vparams.cvp_label4,vendor_labels[3],16); 673 strncpy(vparams.cvp_label4,vendor_labels[3],16);
673 } 674 }
674 if (copy_to_user((void *) arg, &vparams, sizeof(vparams))) 675 if (copy_to_user(argp, &vparams, sizeof(vparams)))
675 return -EFAULT; 676 return -EFAULT;
676 return 0; 677 return 0;
677 } 678 }
@@ -680,7 +681,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
680 { 681 {
681 struct changer_position pos; 682 struct changer_position pos;
682 683
683 if (copy_from_user(&pos, (void*)arg, sizeof (pos))) 684 if (copy_from_user(&pos, argp, sizeof (pos)))
684 return -EFAULT; 685 return -EFAULT;
685 686
686 if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) { 687 if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) {
@@ -699,7 +700,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
699 { 700 {
700 struct changer_move mv; 701 struct changer_move mv;
701 702
702 if (copy_from_user(&mv, (void*)arg, sizeof (mv))) 703 if (copy_from_user(&mv, argp, sizeof (mv)))
703 return -EFAULT; 704 return -EFAULT;
704 705
705 if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) || 706 if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) ||
@@ -721,7 +722,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
721 { 722 {
722 struct changer_exchange mv; 723 struct changer_exchange mv;
723 724
724 if (copy_from_user(&mv, (void*)arg, sizeof (mv))) 725 if (copy_from_user(&mv, argp, sizeof (mv)))
725 return -EFAULT; 726 return -EFAULT;
726 727
727 if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) || 728 if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) ||
@@ -746,7 +747,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
746 { 747 {
747 struct changer_element_status ces; 748 struct changer_element_status ces;
748 749
749 if (copy_from_user(&ces, (void*)arg, sizeof (ces))) 750 if (copy_from_user(&ces, argp, sizeof (ces)))
750 return -EFAULT; 751 return -EFAULT;
751 if (ces.ces_type < 0 || ces.ces_type >= CH_TYPES) 752 if (ces.ces_type < 0 || ces.ces_type >= CH_TYPES)
752 return -EINVAL; 753 return -EINVAL;
@@ -762,7 +763,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
762 unsigned int elem; 763 unsigned int elem;
763 int result,i; 764 int result,i;
764 765
765 if (copy_from_user(&cge, (void*)arg, sizeof (cge))) 766 if (copy_from_user(&cge, argp, sizeof (cge)))
766 return -EFAULT; 767 return -EFAULT;
767 768
768 if (0 != ch_checkrange(ch, cge.cge_type, cge.cge_unit)) 769 if (0 != ch_checkrange(ch, cge.cge_type, cge.cge_unit))
@@ -825,7 +826,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
825 kfree(buffer); 826 kfree(buffer);
826 up(&ch->lock); 827 up(&ch->lock);
827 828
828 if (copy_to_user((void*)arg, &cge, sizeof (cge))) 829 if (copy_to_user(argp, &cge, sizeof (cge)))
829 return -EFAULT; 830 return -EFAULT;
830 return result; 831 return result;
831 } 832 }
@@ -843,7 +844,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
843 struct changer_set_voltag csv; 844 struct changer_set_voltag csv;
844 int elem; 845 int elem;
845 846
846 if (copy_from_user(&csv, (void*)arg, sizeof(csv))) 847 if (copy_from_user(&csv, argp, sizeof(csv)))
847 return -EFAULT; 848 return -EFAULT;
848 849
849 if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) { 850 if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) {
@@ -861,7 +862,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
861 } 862 }
862 863
863 default: 864 default:
864 return scsi_ioctl(ch->device, cmd, (void*)arg); 865 return scsi_ioctl(ch->device, cmd, argp);
865 866
866 } 867 }
867} 868}
@@ -894,9 +895,9 @@ static long ch_ioctl_compat(struct file * file,
894 case CHIOGSTATUS32: 895 case CHIOGSTATUS32:
895 { 896 {
896 struct changer_element_status32 ces32; 897 struct changer_element_status32 ces32;
897 unsigned char *data; 898 unsigned char __user *data;
898 899
899 if (copy_from_user(&ces32, (void*)arg, sizeof (ces32))) 900 if (copy_from_user(&ces32, (void __user *)arg, sizeof (ces32)))
900 return -EFAULT; 901 return -EFAULT;
901 if (ces32.ces_type < 0 || ces32.ces_type >= CH_TYPES) 902 if (ces32.ces_type < 0 || ces32.ces_type >= CH_TYPES)
902 return -EINVAL; 903 return -EINVAL;
diff --git a/include/linux/chio.h b/include/linux/chio.h
index 63035ae67e63..a404c111c937 100644
--- a/include/linux/chio.h
+++ b/include/linux/chio.h
@@ -96,7 +96,7 @@ struct changer_position {
96 */ 96 */
97struct changer_element_status { 97struct changer_element_status {
98 int ces_type; 98 int ces_type;
99 unsigned char *ces_data; 99 unsigned char __user *ces_data;
100}; 100};
101#define CESTATUS_FULL 0x01 /* full */ 101#define CESTATUS_FULL 0x01 /* full */
102#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */ 102#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */