public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [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 *'
Date: Fri, 10 Apr 2026 22:13:49 +0200	[thread overview]
Message-ID: <202604102216.tSE06wuI-lkp@intel.com> (raw)

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

                 reply	other threads:[~2026-04-10 20:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202604102216.tSE06wuI-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox