mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
This commit is contained in:
parent
332b207d65
commit
8b0cedff04
2 changed files with 4 additions and 4 deletions
|
|
@ -1345,7 +1345,7 @@ int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
|
|||
addr = gfn_to_hva(kvm, gfn);
|
||||
if (kvm_is_error_hva(addr))
|
||||
return -EFAULT;
|
||||
r = copy_to_user((void __user *)addr + offset, data, len);
|
||||
r = __copy_to_user((void __user *)addr + offset, data, len);
|
||||
if (r)
|
||||
return -EFAULT;
|
||||
mark_page_dirty(kvm, gfn);
|
||||
|
|
@ -1405,7 +1405,7 @@ int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
|
|||
if (kvm_is_error_hva(ghc->hva))
|
||||
return -EFAULT;
|
||||
|
||||
r = copy_to_user((void __user *)ghc->hva, data, len);
|
||||
r = __copy_to_user((void __user *)ghc->hva, data, len);
|
||||
if (r)
|
||||
return -EFAULT;
|
||||
mark_page_dirty_in_slot(kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT);
|
||||
|
|
|
|||
Loading…
Reference in a new issue