Patchwork [01/56] KVM: PPC: Book3s_32: Fix compile error

login
register
mail settings
Submitter Alexander Graf
Date March 15, 2012, 12:10 p.m.
Message ID <1331813485-14722-2-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/146876/
State New
Headers show

Comments

Alexander Graf - March 15, 2012, 12:10 p.m.
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.

Reported-by: Jörg Sommer <joerg@alea.gnuu.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/book3s_pr.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index ee222ec..f329eae 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -880,7 +880,8 @@  int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
 
 	switch (reg->id) {
 	case KVM_REG_PPC_HIOR:
-		r = put_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+		r = put_user(to_book3s(vcpu)->hior,
+			     (u64 __user *)(long)reg->addr);
 		break;
 	default:
 		break;
@@ -895,7 +896,8 @@  int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
 
 	switch (reg->id) {
 	case KVM_REG_PPC_HIOR:
-		r = get_user(to_book3s(vcpu)->hior, (u64 __user *)reg->addr);
+		r = get_user(to_book3s(vcpu)->hior,
+			     (u64 __user *)(long)reg->addr);
 		if (!r)
 			to_book3s(vcpu)->hior_explicit = true;
 		break;