[kvm:queue 29/111] arch/x86/kvm/svm.c:6073:22: sparse: incorrect type in argument 1 (different base types)

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

 



tree:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
head:   da0fb9f3d73e7ab266d72a9b216ce0f3833c1e83
commit: 0d0736f76347f7e14a3e5bb7a202a75a53ce1e3b [29/111] KVM: SVM: Add support for KVM_SEV_LAUNCH_MEASURE command
reproduce:
        # apt-get install sparse
        git checkout 0d0736f76347f7e14a3e5bb7a202a75a53ce1e3b
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> arch/x86/kvm/svm.c:6073:22: sparse: incorrect type in argument 1 (different base types) @@ expected void const volatile @@ got unsigned long lonvoid const volatile @@
   arch/x86/kvm/svm.c:6073:22: expected void const volatile
   arch/x86/kvm/svm.c:6073:22: got unsigned long long uaddr
   arch/x86/include/asm/paravirt.h:149:9: sparse: cast truncates bits from constant value (100000000 becomes 0)
   arch/x86/include/asm/paravirt.h:149:9: sparse: cast truncates bits from constant value (100000000 becomes 0)

vim +6073 arch/x86/kvm/svm.c

  6044	
  6045	static int sev_launch_measure(struct kvm *kvm, struct kvm_sev_cmd *argp)
  6046	{
  6047		struct kvm_sev_info *sev = &kvm->arch.sev_info;
  6048		struct sev_data_launch_measure *data;
  6049		struct kvm_sev_launch_measure params;
  6050		void *blob = NULL;
  6051		int ret;
  6052	
  6053		if (!sev_guest(kvm))
  6054			return -ENOTTY;
  6055	
  6056		if (copy_from_user(&params, (void __user *)(uintptr_t)argp->data, sizeof(params)))
  6057			return -EFAULT;
  6058	
  6059		data = kzalloc(sizeof(*data), GFP_KERNEL);
  6060		if (!data)
  6061			return -ENOMEM;
  6062	
  6063		/* User wants to query the blob length */
  6064		if (!params.len)
  6065			goto cmd;
  6066	
  6067		if (params.uaddr) {
  6068			if (params.len > SEV_FW_BLOB_MAX_SIZE) {
  6069				ret = -EINVAL;
  6070				goto e_free;
  6071			}
  6072	
> 6073			if (!access_ok(VERIFY_WRITE, params.uaddr, params.len)) {
  6074				ret = -EFAULT;
  6075				goto e_free;
  6076			}
  6077	
  6078			ret = -ENOMEM;
  6079			blob = kmalloc(params.len, GFP_KERNEL);
  6080			if (!blob)
  6081				goto e_free;
  6082	
  6083			data->address = __psp_pa(blob);
  6084			data->len = params.len;
  6085		}
  6086	
  6087	cmd:
  6088		data->handle = sev->handle;
  6089		ret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_MEASURE, data, &argp->error);
  6090	
  6091		/*
  6092		 * If we query the session length, FW responded with expected data.
  6093		 */
  6094		if (!params.len)
  6095			goto done;
  6096	
  6097		if (ret)
  6098			goto e_free_blob;
  6099	
  6100		if (blob) {
  6101			if (copy_to_user((void __user *)(uintptr_t)params.uaddr, blob, params.len))
  6102				ret = -EFAULT;
  6103		}
  6104	
  6105	done:
  6106		params.len = data->len;
  6107		if (copy_to_user((void __user *)(uintptr_t)argp->data, &params, sizeof(params)))
  6108			ret = -EFAULT;
  6109	e_free_blob:
  6110		kfree(blob);
  6111	e_free:
  6112		kfree(data);
  6113		return ret;
  6114	}
  6115	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



[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