mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
KVM: x86: Simplify msr_io()
As of commit bccf2150fe
("KVM: Per-vcpu inodes"), __msr_io() doesn't
return a negative value. Remove unnecessary checks.
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Link: https://lore.kernel.org/r/20230107001256.2365304-7-mhal@rbox.co
[sean: call out commit which left behind the unnecessary check]
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
4559e6cf45
commit
e73ba25fdc
1 changed files with 3 additions and 9 deletions
|
@ -4291,8 +4291,8 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
|
|||
{
|
||||
struct kvm_msrs msrs;
|
||||
struct kvm_msr_entry *entries;
|
||||
int r, n;
|
||||
unsigned size;
|
||||
int r;
|
||||
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&msrs, user_msrs, sizeof(msrs)))
|
||||
|
@ -4309,17 +4309,11 @@ static int msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs __user *user_msrs,
|
|||
goto out;
|
||||
}
|
||||
|
||||
r = n = __msr_io(vcpu, &msrs, entries, do_msr);
|
||||
if (r < 0)
|
||||
goto out_free;
|
||||
r = __msr_io(vcpu, &msrs, entries, do_msr);
|
||||
|
||||
r = -EFAULT;
|
||||
if (writeback && copy_to_user(user_msrs->entries, entries, size))
|
||||
goto out_free;
|
||||
r = -EFAULT;
|
||||
|
||||
r = n;
|
||||
|
||||
out_free:
|
||||
kfree(entries);
|
||||
out:
|
||||
return r;
|
||||
|
|
Loading…
Add table
Reference in a new issue