@@ -1236,15 +1236,15 @@ static int msr_io(PIRP pIrp, struct kvm_vcpu *vcpu,
12361236 unsigned size ;
12371237
12381238 r = - EFAULT ;
1239- if (copy_from_user ( & msrs , user_msrs , sizeof msrs ))
1239+ if (aehdCopyInputBuffer ( pIrp , 0 , & msrs , sizeof msrs ))
12401240 goto out ;
12411241
12421242 r = - E2BIG ;
12431243 if (msrs .nmsrs >= MAX_IO_MSRS )
12441244 goto out ;
12451245
12461246 size = sizeof (struct kvm_msr_entry ) * msrs .nmsrs ;
1247- entries = memdup_user ( user_msrs -> entries , size );
1247+ entries = aehdMemdupUser ( pIrp , sizeof ( msrs ) , size );
12481248 if (IS_ERR (entries )) {
12491249 r = PTR_ERR (entries );
12501250 goto out ;
@@ -1377,7 +1377,7 @@ long kvm_arch_dev_ioctl(struct aehd_device_extension *devext,
13771377 struct kvm_cpuid cpuid ;
13781378
13791379 r = - EFAULT ;
1380- if (copy_from_user ( & cpuid , cpuid_arg , sizeof cpuid ))
1380+ if (aehdCopyInputBuffer ( pIrp , 0 , & cpuid , sizeof cpuid ))
13811381 goto out ;
13821382
13831383 r = kvm_dev_ioctl_get_cpuid (pIrp , & cpuid , cpuid_arg -> entries ,
@@ -1876,7 +1876,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
18761876 r = - EINVAL ;
18771877 if (!lapic_in_kernel (vcpu ))
18781878 goto out ;
1879- u .lapic = memdup_user ( argp , sizeof (* u .lapic ));
1879+ u .lapic = aehdMemdupUser ( pIrp , 0 , sizeof (* u .lapic ));
18801880 if (IS_ERR (u .lapic ))
18811881 return PTR_ERR (u .lapic );
18821882
@@ -1887,7 +1887,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
18871887 struct kvm_interrupt irq ;
18881888
18891889 r = - EFAULT ;
1890- if (copy_from_user ( & irq , argp , sizeof irq ))
1890+ if (aehdCopyInputBuffer ( pIrp , 0 , & irq , sizeof irq ))
18911891 goto out ;
18921892 r = kvm_vcpu_ioctl_interrupt (vcpu , & irq );
18931893 break ;
@@ -1905,9 +1905,10 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
19051905 struct kvm_cpuid cpuid ;
19061906
19071907 r = - EFAULT ;
1908- if (copy_from_user ( & cpuid , cpuid_arg , sizeof cpuid ))
1908+ if (aehdCopyInputBuffer ( pIrp , 0 , & cpuid , sizeof cpuid ))
19091909 goto out ;
1910- r = kvm_vcpu_ioctl_set_cpuid (vcpu , & cpuid ,
1910+
1911+ r = kvm_vcpu_ioctl_set_cpuid (pIrp , vcpu , & cpuid ,
19111912 cpuid_arg -> entries );
19121913 break ;
19131914 }
@@ -1916,7 +1917,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
19161917 struct kvm_cpuid cpuid ;
19171918
19181919 r = - EFAULT ;
1919- if (copy_from_user ( & cpuid , cpuid_arg , sizeof cpuid ))
1920+ if (aehdCopyInputBuffer ( pIrp , 0 , & cpuid , sizeof cpuid ))
19201921 goto out ;
19211922 r = kvm_vcpu_ioctl_get_cpuid (vcpu , & cpuid ,
19221923 cpuid_arg -> entries );
@@ -1939,7 +1940,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
19391940 struct kvm_tpr_access_ctl tac ;
19401941
19411942 r = - EFAULT ;
1942- if (copy_from_user ( & tac , argp , sizeof tac ))
1943+ if (aehdCopyInputBuffer ( pIrp , 0 , & tac , sizeof tac ))
19431944 goto out ;
19441945 r = vcpu_ioctl_tpr_access_reporting (vcpu , & tac );
19451946 if (r )
@@ -1955,7 +1956,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
19551956 if (!lapic_in_kernel (vcpu ))
19561957 goto out ;
19571958 r = - EFAULT ;
1958- if (copy_from_user ( & va , argp , sizeof va ))
1959+ if (aehdCopyInputBuffer ( pIrp , 0 , & va , sizeof va ))
19591960 goto out ;
19601961 idx = srcu_read_lock (& vcpu -> kvm -> srcu );
19611962 r = kvm_lapic_set_vapic_addr (vcpu , va .vapic_addr );
@@ -1975,7 +1976,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
19751976 struct kvm_vcpu_events events ;
19761977
19771978 r = - EFAULT ;
1978- if (copy_from_user ( & events , argp , sizeof (struct kvm_vcpu_events )))
1979+ if (aehdCopyInputBuffer ( pIrp , 0 , & events , sizeof (struct kvm_vcpu_events )))
19791980 break ;
19801981
19811982 r = kvm_vcpu_ioctl_x86_set_vcpu_events (vcpu , & events );
@@ -1994,7 +1995,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
19941995 struct kvm_debugregs dbgregs ;
19951996
19961997 r = - EFAULT ;
1997- if (copy_from_user ( & dbgregs , argp ,
1998+ if (aehdCopyInputBuffer ( pIrp , 0 , & dbgregs ,
19981999 sizeof (struct kvm_debugregs )))
19992000 break ;
20002001
@@ -2014,7 +2015,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
20142015 break ;
20152016 }
20162017 case AEHD_SET_XSAVE : {
2017- u .xsave = memdup_user ( argp , sizeof (* u .xsave ));
2018+ u .xsave = aehdMemdupUser ( pIrp , 0 , sizeof (* u .xsave ));
20182019 if (IS_ERR (u .xsave ))
20192020 return PTR_ERR (u .xsave );
20202021
@@ -2034,7 +2035,7 @@ long kvm_arch_vcpu_ioctl(struct aehd_device_extension *devext,
20342035 break ;
20352036 }
20362037 case AEHD_SET_XCRS : {
2037- u .xcrs = memdup_user ( argp , sizeof (* u .xcrs ));
2038+ u .xcrs = aehdMemdupUser ( pIrp , 0 , sizeof (* u .xcrs ));
20382039 if (IS_ERR (u .xcrs ))
20392040 return PTR_ERR (u .xcrs );
20402041
@@ -2295,7 +2296,7 @@ long kvm_arch_vm_ioctl(struct aehd_device_extension *devext,
22952296 /* 0: PIC master, 1: PIC slave, 2: IOAPIC */
22962297 struct kvm_irqchip * chip ;
22972298
2298- chip = memdup_user ( argp , sizeof (* chip ));
2299+ chip = aehdMemdupUser ( pIrp , 0 , sizeof (* chip ));
22992300 if (IS_ERR (chip )) {
23002301 r = PTR_ERR (chip );
23012302 goto out ;
@@ -2316,7 +2317,7 @@ long kvm_arch_vm_ioctl(struct aehd_device_extension *devext,
23162317 /* 0: PIC master, 1: PIC slave, 2: IOAPIC */
23172318 struct kvm_irqchip * chip ;
23182319
2319- chip = memdup_user ( argp , sizeof (* chip ));
2320+ chip = aehdMemdupUser ( pIrp , 0 , sizeof (* chip ));
23202321 if (IS_ERR (chip )) {
23212322 r = PTR_ERR (chip );
23222323 goto out ;
@@ -2346,7 +2347,7 @@ long kvm_arch_vm_ioctl(struct aehd_device_extension *devext,
23462347 struct kvm_enable_cap cap ;
23472348
23482349 r = - EFAULT ;
2349- if (copy_from_user ( & cap , argp , sizeof (cap )))
2350+ if (aehdCopyInputBuffer ( pIrp , 0 , & cap , sizeof (cap )))
23502351 goto out ;
23512352 r = kvm_vm_ioctl_enable_cap (kvm , & cap );
23522353 break ;
0 commit comments