Skip to content

Commit

Permalink
KVM: ARM/arm64: return -EFAULT if copy_from_user fails in set_timer_reg
Browse files Browse the repository at this point in the history
We currently return the number of bytes not copied if set_timer_reg
fails, which is almost certainly not what userspace would like.

This patch returns -EFAULT instead.

Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
  • Loading branch information
Will Deacon authored and Christoffer Dall committed Aug 27, 2014
1 parent 18d4576 commit bd218bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm/kvm/guest.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)

ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
if (ret != 0)
return ret;
return -EFAULT;

return kvm_arm_timer_set_reg(vcpu, reg->id, val);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kvm/guest.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)

ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id));
if (ret != 0)
return ret;
return -EFAULT;

return kvm_arm_timer_set_reg(vcpu, reg->id, val);
}
Expand Down

0 comments on commit bd218bc

Please sign in to comment.