public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [sean-jc:x86/vfio_kvm_file_refcount 1/1] arch/x86/kvm/../../../virt/kvm/vfio.c:178:35: error: incompatible pointer types passing 'struct kvm *' to parameter of type 'struct file *'
@ 2026-04-10 20:13 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-04-10 20:13 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: llvm, oe-kbuild-all

tree:   https://github.com/sean-jc/linux x86/vfio_kvm_file_refcount
head:   3088b9660354afa55c95eeec0bba6d939123ce06
commit: 3088b9660354afa55c95eeec0bba6d939123ce06 [1/1] tmp
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260410/202604102216.tSE06wuI-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260410/202604102216.tSE06wuI-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604102216.tSE06wuI-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/kvm/../../../virt/kvm/vfio.c:178:35: error: incompatible pointer types passing 'struct kvm *' to parameter of type 'struct file *' [-Werror,-Wincompatible-pointer-types]
     178 |         kvm_vfio_file_set_kvm(kvf->file, dev->kvm);
         |                                          ^~~~~~~~
   arch/x86/kvm/../../../virt/kvm/vfio.c:38:67: note: passing argument to parameter 'kvm' here
      38 | static void kvm_vfio_file_set_kvm(struct file *file, struct file *kvm)
         |                                                                   ^
   1 error generated.


vim +178 arch/x86/kvm/../../../virt/kvm/vfio.c

e0f0bbc527f6e9 Alex Williamson 2013-10-30  142  
2f99073a722bee Yi Liu          2023-07-18  143  static int kvm_vfio_file_add(struct kvm_device *dev, unsigned int fd)
ec53500fae421e Alex Williamson 2013-10-30  144  {
ec53500fae421e Alex Williamson 2013-10-30  145  	struct kvm_vfio *kv = dev->private;
2f99073a722bee Yi Liu          2023-07-18  146  	struct kvm_vfio_file *kvf;
d55d9e7a457218 Jason Gunthorpe 2022-05-04  147  	struct file *filp;
73e2f19da50857 Dmitry Torokhov 2023-07-14  148  	int ret = 0;
ec53500fae421e Alex Williamson 2013-10-30  149  
d55d9e7a457218 Jason Gunthorpe 2022-05-04  150  	filp = fget(fd);
d55d9e7a457218 Jason Gunthorpe 2022-05-04  151  	if (!filp)
ec53500fae421e Alex Williamson 2013-10-30  152  		return -EBADF;
ec53500fae421e Alex Williamson 2013-10-30  153  
b1a59be8a2b64d Yi Liu          2023-07-18  154  	/* Ensure the FD is a vfio FD. */
b1a59be8a2b64d Yi Liu          2023-07-18  155  	if (!kvm_vfio_file_is_valid(filp)) {
3e5449d5f954f5 Jason Gunthorpe 2022-05-04  156  		ret = -EINVAL;
73e2f19da50857 Dmitry Torokhov 2023-07-14  157  		goto out_fput;
3e5449d5f954f5 Jason Gunthorpe 2022-05-04  158  	}
3e5449d5f954f5 Jason Gunthorpe 2022-05-04  159  
ec53500fae421e Alex Williamson 2013-10-30  160  	mutex_lock(&kv->lock);
ec53500fae421e Alex Williamson 2013-10-30  161  
2f99073a722bee Yi Liu          2023-07-18  162  	list_for_each_entry(kvf, &kv->file_list, node) {
2f99073a722bee Yi Liu          2023-07-18  163  		if (kvf->file == filp) {
73b0565f19a8fb Jason Gunthorpe 2022-05-04  164  			ret = -EEXIST;
73e2f19da50857 Dmitry Torokhov 2023-07-14  165  			goto out_unlock;
ec53500fae421e Alex Williamson 2013-10-30  166  		}
ec53500fae421e Alex Williamson 2013-10-30  167  	}
ec53500fae421e Alex Williamson 2013-10-30  168  
69050f8d6d075d Kees Cook       2026-02-20  169  	kvf = kzalloc_obj(*kvf, GFP_KERNEL_ACCOUNT);
2f99073a722bee Yi Liu          2023-07-18  170  	if (!kvf) {
73b0565f19a8fb Jason Gunthorpe 2022-05-04  171  		ret = -ENOMEM;
73e2f19da50857 Dmitry Torokhov 2023-07-14  172  		goto out_unlock;
ec53500fae421e Alex Williamson 2013-10-30  173  	}
ec53500fae421e Alex Williamson 2013-10-30  174  
73e2f19da50857 Dmitry Torokhov 2023-07-14  175  	kvf->file = get_file(filp);
2f99073a722bee Yi Liu          2023-07-18  176  	list_add_tail(&kvf->node, &kv->file_list);
ec53500fae421e Alex Williamson 2013-10-30  177  
9e0f4f2918c2ff Dmitry Torokhov 2023-07-14 @178  	kvm_vfio_file_set_kvm(kvf->file, dev->kvm);
e0f0bbc527f6e9 Alex Williamson 2013-10-30  179  	kvm_vfio_update_coherency(dev);
e0f0bbc527f6e9 Alex Williamson 2013-10-30  180  
73e2f19da50857 Dmitry Torokhov 2023-07-14  181  out_unlock:
73b0565f19a8fb Jason Gunthorpe 2022-05-04  182  	mutex_unlock(&kv->lock);
73e2f19da50857 Dmitry Torokhov 2023-07-14  183  out_fput:
d55d9e7a457218 Jason Gunthorpe 2022-05-04  184  	fput(filp);
73b0565f19a8fb Jason Gunthorpe 2022-05-04  185  	return ret;
73b0565f19a8fb Jason Gunthorpe 2022-05-04  186  }
ec53500fae421e Alex Williamson 2013-10-30  187  

:::::: The code at line 178 was first introduced by commit
:::::: 9e0f4f2918c2ff145d3dedee862d9919a6ed5812 kvm/vfio: ensure kvg instance stays around in kvm_vfio_group_add()

:::::: TO: Dmitry Torokhov <dmitry.torokhov@gmail.com>
:::::: CC: Alex Williamson <alex.williamson@redhat.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-10 20:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 20:13 [sean-jc:x86/vfio_kvm_file_refcount 1/1] arch/x86/kvm/../../../virt/kvm/vfio.c:178:35: error: incompatible pointer types passing 'struct kvm *' to parameter of type 'struct file *' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox