diff options
author | Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> | 2011-05-15 11:22:04 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-12 04:45:03 -0400 |
commit | 8b0cedff040b652f3d36b1368778667581b0c140 (patch) | |
tree | d1a8d8c7368d96830a0b4d6af7aa652ab5a015d6 /arch/x86/kvm/x86.c | |
parent | 332b207d65c1d7982489dbb83e5071c95e19eb75 (diff) |
KVM: use __copy_to_user/__clear_user to write guest page
Simply use __copy_to_user/__clear_user to write guest page since we have
already verified the user address when the memslot is set
Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 51df0b6c891a..0b089860e950 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -1388,7 +1388,7 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1388 | return 1; | 1388 | return 1; |
1389 | kvm_x86_ops->patch_hypercall(vcpu, instructions); | 1389 | kvm_x86_ops->patch_hypercall(vcpu, instructions); |
1390 | ((unsigned char *)instructions)[3] = 0xc3; /* ret */ | 1390 | ((unsigned char *)instructions)[3] = 0xc3; /* ret */ |
1391 | if (copy_to_user((void __user *)addr, instructions, 4)) | 1391 | if (__copy_to_user((void __user *)addr, instructions, 4)) |
1392 | return 1; | 1392 | return 1; |
1393 | kvm->arch.hv_hypercall = data; | 1393 | kvm->arch.hv_hypercall = data; |
1394 | break; | 1394 | break; |
@@ -1415,7 +1415,7 @@ static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) | |||
1415 | HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT); | 1415 | HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT); |
1416 | if (kvm_is_error_hva(addr)) | 1416 | if (kvm_is_error_hva(addr)) |
1417 | return 1; | 1417 | return 1; |
1418 | if (clear_user((void __user *)addr, PAGE_SIZE)) | 1418 | if (__clear_user((void __user *)addr, PAGE_SIZE)) |
1419 | return 1; | 1419 | return 1; |
1420 | vcpu->arch.hv_vapic = data; | 1420 | vcpu->arch.hv_vapic = data; |
1421 | break; | 1421 | break; |