RE: usbip: vhci extension: modifications to vhci driver

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

 



Hello,

I will send a patch to clear this warning.

The current behavior is as following:
vdev_to_vhci() is inline of container_of().
A pointer (struct vhci_hcd *vhci) may be container_of() from NULL for a
while.
If it is container_of() from NULL, it will not be referenced because of
 NULL check of source pointer of the container_of().

Thank you,

n.iwata
//
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx]
> Sent: Tuesday, October 11, 2016 4:03 PM
> To: fx IWATA NOBUO
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Subject: re: usbip: vhci extension: modifications to vhci driver
> 
> Hello Nobuo Iwata,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 0775a9cbc694: "usbip: vhci extension: modifications to vhci
> driver" from Jun 13, 2016, leads to the following Smatch complaint:
> 
> drivers/usb/usbip/vhci_hcd.c:466 vhci_tx_urb()
> 	 warn: variable dereferenced before check 'vdev' (see line 463)
> 
> drivers/usb/usbip/vhci_hcd.c
>    462		struct vhci_priv *priv;
>    463		struct vhci_hcd *vhci = vdev_to_vhci(vdev);
>                                         ^^^^^^^^^^^^^^^^^^ Patch adds a
> new dereference inside the vdev_to_vhci() function.
> 
>    464		unsigned long flags;
>    465
>    466		if (!vdev) {
>                     ^^^^^
> Old code assumed "vdev" could be NULL.
> 
>    467			pr_err("could not get virtual device");
>    468			return;
> 
> regards,
> dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux