On Wed, Sep 15, 2021 at 10:58:31AM +0300, Dan Carpenter wrote:
tree:
https://github.com/jgunthorpe/linux vfio_ccw
head: d0d01fdc87368c19ee6cac8e7ab2c0ef7ab33efb
commit: c7863bcc74538df3d39bd9407ae77f6ef778f7b3 [7/12] vfio/mdev: Add mdev available
instance checking to the core
config: x86_64-randconfig-m001-20210914 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/vfio/mdev/mdev_core.c:319 mdev_device_create() warn: variable dereferenced before
check 'drv' (see line 272)
vim +/drv +319 drivers/vfio/mdev/mdev_core.c
417fd5bf242d76 Jason Gunthorpe 2021-04-06 255 int mdev_device_create(struct mdev_type
*type, const guid_t *uuid)
7b96953bc640b6 Kirti Wankhede 2016-11-17 256 {
7b96953bc640b6 Kirti Wankhede 2016-11-17 257 int ret;
002fe996f67f4f Alex Williamson 2018-05-15 258 struct mdev_device *mdev, *tmp;
a9f8111d0b5f44 Jason Gunthorpe 2021-04-06 259 struct mdev_parent *parent =
type->parent;
88a21f265ce50a Jason Gunthorpe 2021-06-17 260 struct mdev_driver *drv =
parent->ops->device_driver;
7b96953bc640b6 Kirti Wankhede 2016-11-17 261
002fe996f67f4f Alex Williamson 2018-05-15 262 mutex_lock(&mdev_list_lock);
7b96953bc640b6 Kirti Wankhede 2016-11-17 263
7b96953bc640b6 Kirti Wankhede 2016-11-17 264 /* Check for duplicate */
002fe996f67f4f Alex Williamson 2018-05-15 265 list_for_each_entry(tmp, &mdev_list,
next) {
278bca7f318e6a Andy Shevchenko 2019-01-10 266 if (guid_equal(&tmp->uuid,
uuid)) {
002fe996f67f4f Alex Williamson 2018-05-15 267 mutex_unlock(&mdev_list_lock);
fbd0e2b0c3d0b2 Jason Gunthorpe 2021-04-06 268 return -EEXIST;
002fe996f67f4f Alex Williamson 2018-05-15 269 }
7b96953bc640b6 Kirti Wankhede 2016-11-17 270 }
7b96953bc640b6 Kirti Wankhede 2016-11-17 271
c7863bcc74538d Jason Gunthorpe 2021-09-07 @272 if (drv->get_available) {
^^^^^^^^^^^^^^^^^^
Dereference
woops, got it, thanks Dan
Jason