diff options
author | Marc Zyngier <maz@kernel.org> | 2022-07-05 11:27:37 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2022-07-17 11:55:33 +0100 |
commit | d7df6f282db67677c06456fd29d47eda0ba060b9 (patch) | |
tree | ba7382184337ed0547fd4d568f64cecf75d4e792 /arch/arm64/kvm/vgic/vgic-kvm-device.c | |
parent | 7e9f723c2a90e41407d5889700169be4797a2009 (diff) | |
download | linux-d7df6f282db67677c06456fd29d47eda0ba060b9.tar.gz linux-d7df6f282db67677c06456fd29d47eda0ba060b9.tar.bz2 linux-d7df6f282db67677c06456fd29d47eda0ba060b9.zip |
KVM: arm64: vgic: Use {get,put}_user() instead of copy_{from.to}_user
Tidy-up vgic_get_common_attr() and vgic_set_common_attr() to use
{get,put}_user() instead of the more complex (and less type-safe)
copy_{from,to}_user().
Reviewed-by: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm/vgic/vgic-kvm-device.c')
-rw-r--r-- | arch/arm64/kvm/vgic/vgic-kvm-device.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm64/kvm/vgic/vgic-kvm-device.c b/arch/arm64/kvm/vgic/vgic-kvm-device.c index 066b95d606fd..c17e5502c0b3 100644 --- a/arch/arm64/kvm/vgic/vgic-kvm-device.c +++ b/arch/arm64/kvm/vgic/vgic-kvm-device.c @@ -170,7 +170,7 @@ static int vgic_set_common_attr(struct kvm_device *dev, u64 addr; unsigned long type = (unsigned long)attr->attr; - if (copy_from_user(&addr, uaddr, sizeof(addr))) + if (get_user(addr, uaddr)) return -EFAULT; r = kvm_vgic_addr(dev->kvm, type, &addr, true); @@ -233,14 +233,14 @@ static int vgic_get_common_attr(struct kvm_device *dev, u64 addr; unsigned long type = (unsigned long)attr->attr; - if (copy_from_user(&addr, uaddr, sizeof(addr))) + if (get_user(addr, uaddr)) return -EFAULT; r = kvm_vgic_addr(dev->kvm, type, &addr, false); if (r) return (r == -ENODEV) ? -ENXIO : r; - if (copy_to_user(uaddr, &addr, sizeof(addr))) + if (put_user(addr, uaddr)) return -EFAULT; break; } |