* [linux-next:pending-fixes 228/518] drivers/virt/acrn/irqfd.c:163:13: sparse: sparse: restricted __poll_t degrades to integer
@ 2021-03-10 1:36 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-10 1:36 UTC (permalink / raw)
To: Yejune Deng
Cc: kbuild-all, Linux Memory Management List, Greg Kroah-Hartman, Shuo Liu
[-- Attachment #1: Type: text/plain, Size: 6343 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git pending-fixes
head: b9bb7c062cc95f0fb891ebf697a54d0ebead7038
commit: 803c1aadecdb5d2f4cf86c029607e5c68f63e794 [228/518] virt: acrn: Use vfs_poll() instead of f_op->poll()
config: x86_64-randconfig-s022-20210310 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-262-g5e674421-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=803c1aadecdb5d2f4cf86c029607e5c68f63e794
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next pending-fixes
git checkout 803c1aadecdb5d2f4cf86c029607e5c68f63e794
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
>> drivers/virt/acrn/irqfd.c:163:13: sparse: sparse: restricted __poll_t degrades to integer
vim +163 drivers/virt/acrn/irqfd.c
aa3b483ff1d71c Shuo Liu 2021-02-07 105
aa3b483ff1d71c Shuo Liu 2021-02-07 106 /*
aa3b483ff1d71c Shuo Liu 2021-02-07 107 * Assign an eventfd to a VM and create a HSM irqfd associated with the
aa3b483ff1d71c Shuo Liu 2021-02-07 108 * eventfd. The properties of the HSM irqfd are built from a &struct
aa3b483ff1d71c Shuo Liu 2021-02-07 109 * acrn_irqfd.
aa3b483ff1d71c Shuo Liu 2021-02-07 110 */
aa3b483ff1d71c Shuo Liu 2021-02-07 111 static int acrn_irqfd_assign(struct acrn_vm *vm, struct acrn_irqfd *args)
aa3b483ff1d71c Shuo Liu 2021-02-07 112 {
aa3b483ff1d71c Shuo Liu 2021-02-07 113 struct eventfd_ctx *eventfd = NULL;
aa3b483ff1d71c Shuo Liu 2021-02-07 114 struct hsm_irqfd *irqfd, *tmp;
803c1aadecdb5d Yejune Deng 2021-02-21 115 __poll_t events;
aa3b483ff1d71c Shuo Liu 2021-02-07 116 struct fd f;
aa3b483ff1d71c Shuo Liu 2021-02-07 117 int ret = 0;
aa3b483ff1d71c Shuo Liu 2021-02-07 118
aa3b483ff1d71c Shuo Liu 2021-02-07 119 irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL);
aa3b483ff1d71c Shuo Liu 2021-02-07 120 if (!irqfd)
aa3b483ff1d71c Shuo Liu 2021-02-07 121 return -ENOMEM;
aa3b483ff1d71c Shuo Liu 2021-02-07 122
aa3b483ff1d71c Shuo Liu 2021-02-07 123 irqfd->vm = vm;
aa3b483ff1d71c Shuo Liu 2021-02-07 124 memcpy(&irqfd->msi, &args->msi, sizeof(args->msi));
aa3b483ff1d71c Shuo Liu 2021-02-07 125 INIT_LIST_HEAD(&irqfd->list);
aa3b483ff1d71c Shuo Liu 2021-02-07 126 INIT_WORK(&irqfd->shutdown, hsm_irqfd_shutdown_work);
aa3b483ff1d71c Shuo Liu 2021-02-07 127
aa3b483ff1d71c Shuo Liu 2021-02-07 128 f = fdget(args->fd);
aa3b483ff1d71c Shuo Liu 2021-02-07 129 if (!f.file) {
aa3b483ff1d71c Shuo Liu 2021-02-07 130 ret = -EBADF;
aa3b483ff1d71c Shuo Liu 2021-02-07 131 goto out;
aa3b483ff1d71c Shuo Liu 2021-02-07 132 }
aa3b483ff1d71c Shuo Liu 2021-02-07 133
aa3b483ff1d71c Shuo Liu 2021-02-07 134 eventfd = eventfd_ctx_fileget(f.file);
aa3b483ff1d71c Shuo Liu 2021-02-07 135 if (IS_ERR(eventfd)) {
aa3b483ff1d71c Shuo Liu 2021-02-07 136 ret = PTR_ERR(eventfd);
aa3b483ff1d71c Shuo Liu 2021-02-07 137 goto fail;
aa3b483ff1d71c Shuo Liu 2021-02-07 138 }
aa3b483ff1d71c Shuo Liu 2021-02-07 139
aa3b483ff1d71c Shuo Liu 2021-02-07 140 irqfd->eventfd = eventfd;
aa3b483ff1d71c Shuo Liu 2021-02-07 141
aa3b483ff1d71c Shuo Liu 2021-02-07 142 /*
aa3b483ff1d71c Shuo Liu 2021-02-07 143 * Install custom wake-up handling to be notified whenever underlying
aa3b483ff1d71c Shuo Liu 2021-02-07 144 * eventfd is signaled.
aa3b483ff1d71c Shuo Liu 2021-02-07 145 */
aa3b483ff1d71c Shuo Liu 2021-02-07 146 init_waitqueue_func_entry(&irqfd->wait, hsm_irqfd_wakeup);
aa3b483ff1d71c Shuo Liu 2021-02-07 147 init_poll_funcptr(&irqfd->pt, hsm_irqfd_poll_func);
aa3b483ff1d71c Shuo Liu 2021-02-07 148
aa3b483ff1d71c Shuo Liu 2021-02-07 149 mutex_lock(&vm->irqfds_lock);
aa3b483ff1d71c Shuo Liu 2021-02-07 150 list_for_each_entry(tmp, &vm->irqfds, list) {
aa3b483ff1d71c Shuo Liu 2021-02-07 151 if (irqfd->eventfd != tmp->eventfd)
aa3b483ff1d71c Shuo Liu 2021-02-07 152 continue;
aa3b483ff1d71c Shuo Liu 2021-02-07 153 ret = -EBUSY;
aa3b483ff1d71c Shuo Liu 2021-02-07 154 mutex_unlock(&vm->irqfds_lock);
aa3b483ff1d71c Shuo Liu 2021-02-07 155 goto fail;
aa3b483ff1d71c Shuo Liu 2021-02-07 156 }
aa3b483ff1d71c Shuo Liu 2021-02-07 157 list_add_tail(&irqfd->list, &vm->irqfds);
aa3b483ff1d71c Shuo Liu 2021-02-07 158 mutex_unlock(&vm->irqfds_lock);
aa3b483ff1d71c Shuo Liu 2021-02-07 159
aa3b483ff1d71c Shuo Liu 2021-02-07 160 /* Check the pending event in this stage */
803c1aadecdb5d Yejune Deng 2021-02-21 161 events = vfs_poll(f.file, &irqfd->pt);
aa3b483ff1d71c Shuo Liu 2021-02-07 162
aa3b483ff1d71c Shuo Liu 2021-02-07 @163 if (events & POLLIN)
aa3b483ff1d71c Shuo Liu 2021-02-07 164 acrn_irqfd_inject(irqfd);
aa3b483ff1d71c Shuo Liu 2021-02-07 165
aa3b483ff1d71c Shuo Liu 2021-02-07 166 fdput(f);
aa3b483ff1d71c Shuo Liu 2021-02-07 167 return 0;
aa3b483ff1d71c Shuo Liu 2021-02-07 168 fail:
aa3b483ff1d71c Shuo Liu 2021-02-07 169 if (eventfd && !IS_ERR(eventfd))
aa3b483ff1d71c Shuo Liu 2021-02-07 170 eventfd_ctx_put(eventfd);
aa3b483ff1d71c Shuo Liu 2021-02-07 171
aa3b483ff1d71c Shuo Liu 2021-02-07 172 fdput(f);
aa3b483ff1d71c Shuo Liu 2021-02-07 173 out:
aa3b483ff1d71c Shuo Liu 2021-02-07 174 kfree(irqfd);
aa3b483ff1d71c Shuo Liu 2021-02-07 175 return ret;
aa3b483ff1d71c Shuo Liu 2021-02-07 176 }
aa3b483ff1d71c Shuo Liu 2021-02-07 177
:::::: The code at line 163 was first introduced by commit
:::::: aa3b483ff1d71c50b33db154048dff9a8f08ac71 virt: acrn: Introduce irqfd
:::::: TO: Shuo Liu <shuo.a.liu@intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34366 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-03-10 1:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 1:36 [linux-next:pending-fixes 228/518] drivers/virt/acrn/irqfd.c:163:13: sparse: sparse: restricted __poll_t degrades to integer 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