Re: [kvm:queue 305/328] arch/x86/kvm/x86.c:4345:32: warning: cast to pointer from integer of different size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/27/22 09:08, Like Xu wrote:


Similar to kvm_arch_tsc_{s,g}et_attr(), how about this fix:

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8033eca6f..6d4e961d0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4342,7 +4342,7 @@ static int kvm_x86_dev_get_attr(struct kvm_device_attr *attr)

         switch (attr->attr) {
         case KVM_X86_XCOMP_GUEST_SUPP:
-               if (put_user(supported_xcr0, (u64 __user *)attr->addr))
+               if (put_user(supported_xcr0, (u64 __user *)(unsigned long)attr->addr))
                         return -EFAULT;
                 return 0;
         default:

This has to be (at least in the future) 64 bits, so it has to use copy_to_user.

I'll send a v2 of the patches today.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux