[bug report] vfio: ccw: introduce a finite state machine

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

 



Hello Dong Jia Shi,

This is a semi-automatic email about new static checker warnings.

The patch bbe37e4cb897: "vfio: ccw: introduce a finite state machine" 
from Mar 17, 2017, leads to the following Smatch complaint:

    drivers/s390/cio/vfio_ccw_ops.c:151 vfio_ccw_mdev_remove()
    error: we previously assumed 'private' could be null (see line 137)

drivers/s390/cio/vfio_ccw_ops.c
   131  static int vfio_ccw_mdev_remove(struct mdev_device *mdev)
   132  {
   133          struct vfio_ccw_private *private =
   134                  dev_get_drvdata(mdev_parent_dev(mdev));
   135          int ret;
   136	
   137		if (!private)
                    ^^^^^^^^
New check for NULL.

   138			goto out;

I always feel like "out" is a crap name for a label because it doesn't
give you any clue what the goto does.  Label names should be a verb
goto inc_available.  I see this a lot in reviewing static checker
warnings that out labels are more buggy than verb based labels.

   139	
   140		if ((private->state == VFIO_CCW_STATE_NOT_OPER) ||
   141		    (private->state == VFIO_CCW_STATE_STANDBY))
   142			goto out;
   143	
   144		ret = vfio_ccw_mdev_reset(mdev);
   145		if (ret)
   146			return ret;
   147	
   148		private->state = VFIO_CCW_STATE_STANDBY;
   149	
   150	out:
   151		private->mdev = NULL;
                ^^^^^^^^^^^^^^^^^^^^^
New dereference.

   152		atomic_inc(&private->avail);
   153	

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux