Hi all,
After merging the final tree, today's linux-next build (powerpc
ppc44x_defconfig) failed like this:
cc1: warnings being treated as errors
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function '__kvm_set_memory_region':
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
Caused by commit 95de6ce677d6 ("KVM: add missing void __user * cast to
access_ok() call").
I have reverted that commit for today.
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
On Wed, May 25, 2011 at 01:28:09PM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the final tree, today's linux-next build (powerpc
> ppc44x_defconfig) failed like this:
>
> cc1: warnings being treated as errors
> arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function '__kvm_set_memory_region':
> arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
> arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
>
> Caused by commit 95de6ce677d6 ("KVM: add missing void __user * cast to
> access_ok() call").
>
> I have reverted that commit for today.
My fault.. sigh.
Avi could you apply the patch below as well (or merge with the previous one)?
Thanks!
Subject: [PATCH] KVM: fix userspace_addr cast in access_ok() call
From: Heiko Carstens <[email protected]>
mem->userspace_addr is u64. Casting that to a pointer will cause build
breakage (or warnings) on 32 bit architectures. So add an explicit
unsigned long cast as well...
Fixes this:
cc1: warnings being treated as errors
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function '__kvm_set_memory_region':
arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
Signed-off-by: Heiko Carstens <[email protected]>
---
virt/kvm/kvm_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -651,7 +651,8 @@ int __kvm_set_memory_region(struct kvm *
/* We can read the guest memory with __xxx_user() later on. */
if (user_alloc &&
((mem->userspace_addr & (PAGE_SIZE - 1)) ||
- !access_ok(VERIFY_WRITE, (void __user *)mem->userspace_addr,
+ !access_ok(VERIFY_WRITE,
+ (void __user *)(unsigned long)mem->userspace_addr,
mem->memory_size)))
goto out;
if (mem->slot >= KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
On 05/25/2011 11:02 AM, Heiko Carstens wrote:
> On Wed, May 25, 2011 at 01:28:09PM +1000, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the final tree, today's linux-next build (powerpc
> > ppc44x_defconfig) failed like this:
> >
> > cc1: warnings being treated as errors
> > arch/powerpc/kvm/../../../virt/kvm/kvm_main.c: In function '__kvm_set_memory_region':
> > arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
> > arch/powerpc/kvm/../../../virt/kvm/kvm_main.c:654: error: cast to pointer from integer of different size
> >
> > Caused by commit 95de6ce677d6 ("KVM: add missing void __user * cast to
> > access_ok() call").
> >
> > I have reverted that commit for today.
>
> My fault.. sigh.
>
> Avi could you apply the patch below as well (or merge with the previous one)?
>
Thanks for the quick fix, applied.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.