diff options
author | Alexander Graf <agraf@suse.de> | 2012-03-13 14:59:39 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2012-04-03 02:42:14 -0400 |
commit | b8e6f8ae511d88732247aa2af26bfd1bef21b2f4 (patch) | |
tree | d5b4829b97465aef2660ec4cef3f38b70b402608 /arch/powerpc | |
parent | b1a808ff436343956a6ae63178ea1810c5e5a3a1 (diff) |
KVM: PPC: Book3S: Compile fix for ppc32 in HIOR access code
We were failing to compile on book3s_32 with the following errors:
arch/powerpc/kvm/book3s_pr.c:883:45: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
arch/powerpc/kvm/book3s_pr.c:898:79: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
Fix this by explicity casting the u64 to long before we use it as a pointer.
Also, on PPC32 we can not use get_user/put_user for 64bit wide variables,
as there is no single instruction that could load or store variables that big.
So instead, we have to use copy_from/to_user which works everywhere.
Reported-by: Jörg Sommer <joerg@alea.gnuu.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/book3s_pr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c index 642d88574b07..a657c44b7fbc 100644 --- a/arch/powerpc/kvm/book3s_pr.c +++ b/arch/powerpc/kvm/book3s_pr.c | |||
@@ -881,7 +881,8 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
881 | 881 | ||
882 | switch (reg->id) { | 882 | switch (reg->id) { |
883 | case KVM_REG_PPC_HIOR: | 883 | case KVM_REG_PPC_HIOR: |
884 | r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr); | 884 | r = copy_to_user((u64 __user *)(long)reg->addr, |
885 | &to_book3s(vcpu)->hior, sizeof(u64)); | ||
885 | break; | 886 | break; |
886 | default: | 887 | default: |
887 | break; | 888 | break; |
@@ -896,7 +897,8 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg) | |||
896 | 897 | ||
897 | switch (reg->id) { | 898 | switch (reg->id) { |
898 | case KVM_REG_PPC_HIOR: | 899 | case KVM_REG_PPC_HIOR: |
899 | r = get_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr); | 900 | r = copy_from_user(&to_book3s(vcpu)->hior, |
901 | (u64 __user *)(long)reg->addr, sizeof(u64)); | ||
900 | if (!r) | 902 | if (!r) |
901 | to_book3s(vcpu)->hior_explicit = true; | 903 | to_book3s(vcpu)->hior_explicit = true; |
902 | break; | 904 | break; |