* [PATCH, -next] KVM: x86: Fix 32-bit host build warning
@ 2009-10-20 12:15 Jan Kiszka
2009-10-20 17:01 ` Marcelo Tosatti
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2009-10-20 12:15 UTC (permalink / raw)
To: Avi Kivity, Marcelo Tosatti; +Cc: kvm-devel, Ed Swierk
Fixes "cast to pointer from integer of different size" on 32-bit hosts
and applies a micro-refactoring.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
x86.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 3270b3b..5bfda89 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -841,11 +841,12 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 data)
static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
{
+ struct kvm *kvm = vcpu->kvm;
int lm = is_long_mode(vcpu);
- u8 *blob_addr = lm ? (u8 *)vcpu->kvm->arch.xen_hvm_config.blob_addr_64
- : (u8 *)vcpu->kvm->arch.xen_hvm_config.blob_addr_32;
- u8 blob_size = lm ? vcpu->kvm->arch.xen_hvm_config.blob_size_64
- : vcpu->kvm->arch.xen_hvm_config.blob_size_32;
+ u8 *blob_addr = lm ? (u8 *)(long)kvm->arch.xen_hvm_config.blob_addr_64
+ : (u8 *)kvm->arch.xen_hvm_config.blob_addr_32;
+ u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
+ : kvm->arch.xen_hvm_config.blob_size_32;
u32 page_num = data & ~PAGE_MASK;
u64 page_addr = data & PAGE_MASK;
u8 *page;
@@ -861,7 +862,7 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
r = -EFAULT;
if (copy_from_user(page, blob_addr + (page_num * PAGE_SIZE), PAGE_SIZE))
goto out_free;
- if (kvm_write_guest(vcpu->kvm, page_addr, page, PAGE_SIZE))
+ if (kvm_write_guest(kvm, page_addr, page, PAGE_SIZE))
goto out_free;
r = 0;
out_free:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH, -next] KVM: x86: Fix 32-bit host build warning
2009-10-20 12:15 [PATCH, -next] KVM: x86: Fix 32-bit host build warning Jan Kiszka
@ 2009-10-20 17:01 ` Marcelo Tosatti
2009-10-22 10:40 ` Jan Kiszka
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2009-10-20 17:01 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Avi Kivity, kvm-devel, Ed Swierk
On Tue, Oct 20, 2009 at 02:15:10PM +0200, Jan Kiszka wrote:
> Fixes "cast to pointer from integer of different size" on 32-bit hosts
> and applies a micro-refactoring.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH, -next] KVM: x86: Fix 32-bit host build warning
2009-10-20 17:01 ` Marcelo Tosatti
@ 2009-10-22 10:40 ` Jan Kiszka
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2009-10-22 10:40 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: Avi Kivity, kvm-devel, Ed Swierk
Marcelo Tosatti wrote:
> On Tue, Oct 20, 2009 at 02:15:10PM +0200, Jan Kiszka wrote:
>> Fixes "cast to pointer from integer of different size" on 32-bit hosts
>> and applies a micro-refactoring.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>
> Applied, thanks.
Mmpf, sorry, please replace that patch (provided it is still only in
-next) with the actually tested version below. There was one further
typecast missing.
Jan
----------->
Fixes "cast to pointer from integer of different size" on 32-bit hosts
and applies a micro-refactoring.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
arch/x86/kvm/x86.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 3270b3b..5ad65b4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -841,11 +841,12 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, u32 msr, u64 data)
static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
{
+ struct kvm *kvm = vcpu->kvm;
int lm = is_long_mode(vcpu);
- u8 *blob_addr = lm ? (u8 *)vcpu->kvm->arch.xen_hvm_config.blob_addr_64
- : (u8 *)vcpu->kvm->arch.xen_hvm_config.blob_addr_32;
- u8 blob_size = lm ? vcpu->kvm->arch.xen_hvm_config.blob_size_64
- : vcpu->kvm->arch.xen_hvm_config.blob_size_32;
+ u8 *blob_addr = lm ? (u8 *)(long)kvm->arch.xen_hvm_config.blob_addr_64
+ : (u8 *)(long)kvm->arch.xen_hvm_config.blob_addr_32;
+ u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
+ : kvm->arch.xen_hvm_config.blob_size_32;
u32 page_num = data & ~PAGE_MASK;
u64 page_addr = data & PAGE_MASK;
u8 *page;
@@ -861,7 +862,7 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
r = -EFAULT;
if (copy_from_user(page, blob_addr + (page_num * PAGE_SIZE), PAGE_SIZE))
goto out_free;
- if (kvm_write_guest(vcpu->kvm, page_addr, page, PAGE_SIZE))
+ if (kvm_write_guest(kvm, page_addr, page, PAGE_SIZE))
goto out_free;
r = 0;
out_free:
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-22 10:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20 12:15 [PATCH, -next] KVM: x86: Fix 32-bit host build warning Jan Kiszka
2009-10-20 17:01 ` Marcelo Tosatti
2009-10-22 10:40 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).