Skip to contentSkip to conversation

kvm/mmu: Resolve compile warning

PATCH In review javier martinez canillas 3 participants 4 messages Oct 11, 2009 – Oct 13, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm/mmu: Resolve compile warning

I got this compile warning with today linux-next:

arch/x86/kvm/mmu.c: In function ‘kvm_set_pte_rmapp’:
arch/x86/kvm/mmu.c:770: warning: cast to pointer from integer of different size arch/x86/kvm/mmu.c: In function ‘kvm_set_spte_hva’:
arch/x86/kvm/mmu.c:849: warning: cast from pointer to integer of different size

This patch solves the issue:

---
 arch/x86/kvm/mmu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/mmu.c +2 -2
index 20a2cd1..a0b2610 100644
@@ -767,7 +767,7 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
 {
 	int need_flush = 0;
 	u64 *spte, new_spte;
-	pte_t *ptep = (pte_t *)data;
+	pte_t *ptep = (pte_t *)(unsigned long)data;
 	pfn_t new_pfn;
 
 	WARN_ON(pte_huge(*ptep));
@@ -846,7 +846,7 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
 
 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
 {
-	kvm_handle_hva(kvm, hva, (u64)&pte, kvm_set_pte_rmapp);
+	kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp);
 }
 
 static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 28 lines · javier martinez canillas

I got this compile warning with today linux-next:

arch/x86/kvm/mmu.c: In function ‘kvm_set_pte_rmapp’:
arch/x86/kvm/mmu.c:770: warning: cast to pointer from integer of different size arch/x86/kvm/mmu.c: In function ‘kvm_set_spte_hva’:
arch/x86/kvm/mmu.c:849: warning: cast from pointer to integer of different size

This patch solves the issue:

---
 arch/x86/kvm/mmu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kvm/mmu.c +1 -1
index 20a2cd1..a0b2610 100644
@@ -767,7 +767,7 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)
 {
 	int need_flush = 0;
 	u64 *spte, new_spte;
-	pte_t *ptep = (pte_t *)data;
+	pte_t *ptep = (pte_t *)(unsigned long)data;
 	pfn_t new_pfn;
 
 	WARN_ON(pte_huge(*ptep));

arch/x86/kvm/mmu.c int kvm_unmap_hva(struct kvm *kvm, unsigned long hva) · line 852

Quoted 8 lines
arch/x86/kvm/mmu.c +1 -1
@@ -846,7 +846,7 @@ int kvm_unmap_hva(struct kvm *kvm, unsigned long hva)
 
 void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte)
 {
-	kvm_handle_hva(kvm, hva, (u64)&pte, kvm_set_pte_rmapp);
+	kvm_handle_hva(kvm, hva, (unsigned long)&pte, kvm_set_pte_rmapp);
 }
 
 static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp, u64 data)

Hi javier,
from the part is see in the patch i see the follwing problem:
in kvm_set_pte_rmapp() you cast an U64 to (unsigned long)
it seems that kvm_set_pte_rmapp is mapped via kvm_handle_hva(). here pte_t pte is casted into (unsigned long).
Does look wired.

btw: there is also cleanup available claiming to fix the same warning
http://article.gmane.org/gmane.linux.kernel/900102

ntl: to much casting points to seroius trouble

re,
wh

#2 lore raw
In reply to javier martinez canillas

javier,

This is fixed in the -next branch of kvm.git. Thanks.

Quoted 10 lines · javier martinez canillas

I got this compile warning with today linux-next:

arch/x86/kvm/mmu.c: In function ‘kvm_set_pte_rmapp’:
arch/x86/kvm/mmu.c:770: warning: cast to pointer from integer of different size arch/x86/kvm/mmu.c: In function ‘kvm_set_spte_hva’:
arch/x86/kvm/mmu.c:849: warning: cast from pointer to integer of different size

This patch solves the issue:

#3 lore raw

Thank you. Sorry for the noise.

Best regards

-----------------------------------------
Javier Martínez Canillas
+595 981 88 66 58

Quoted 17 lines · Marcelo Tosatti

javier,

This is fixed in the -next branch of kvm.git. Thanks.

Quoted 10 lines · javier martinez canillas

I got this compile warning with today linux-next:

arch/x86/kvm/mmu.c: In function ‘kvm_set_pte_rmapp’:
arch/x86/kvm/mmu.c:770: warning: cast to pointer from integer of different size arch/x86/kvm/mmu.c: In function ‘kvm_set_spte_hva’:
arch/x86/kvm/mmu.c:849: warning: cast from pointer to integer of different size

This patch solves the issue: