Skip to content

Commit

Permalink
KVM: x86: Simplify msr_io()
Browse files Browse the repository at this point in the history
As of commit bccf215 ("KVM: Per-vcpu inodes"), __msr_io() doesn't
return a negative value. Remove unnecessary checks.

Signed-off-by: Michal Luczaj <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[sean: call out commit which left behind the unnecessary check]
Signed-off-by: Sean Christopherson <[email protected]>
  • Loading branch information
mmhal authored and sean-jc committed Feb 3, 2023
1 parent 4559e6c commit e73ba25
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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 = n;
r = -EFAULT;

out_free:
kfree(entries);
out:
return r;
Expand Down

0 comments on commit e73ba25

Please sign in to comment.