Re: [bug report] usbip: vhci-hcd: Set the vhci structure up to work

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

 



Hi Yuyang Du,

On 06/26/2017 12:14 AM, Yuyang Du wrote:
> Sorry. CC related people.
> 
> On Mon, Jun 26, 2017 at 12:04:54PM +0800, Yuyang Du wrote:
>> Hi Dan,
>>
>> Thanks for the report. A patch to fix the bug follows:
>>
>> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
>> index 64c3860..2c4b2fd 100644
>> --- a/drivers/usb/usbip/vhci_hcd.c
>> +++ b/drivers/usb/usbip/vhci_hcd.c
>> @@ -1301,7 +1301,7 @@ static struct hc_driver vhci_hc_driver = {
>>  
>>  static int vhci_hcd_probe(struct platform_device *pdev)
>>  {
>> -	struct vhci		*vhci;
>> +	struct vhci             *vhci = *((void **)dev_get_platdata(&pdev->dev));
>>  	struct usb_hcd		*hcd_hs;
>>  	struct usb_hcd		*hcd_ss;
>>  	int			ret;
>>
>> Thanks,
>> Yuyang

I am assuming you are planning to send a proper patch for this problem
that can be applied.

thanks,
-- Shuah

>>
>> On Fri, Jun 23, 2017 at 01:46:01PM +0300, Dan Carpenter wrote:
>>> Hello Yuyang Du,
>>>
>>> The patch 03cd00d538a6: "usbip: vhci-hcd: Set the vhci structure up
>>> to work" from Jun 8, 2017, leads to the following static checker
>>> warning:
>>>
>>> 	drivers/usb/usbip/vhci_hcd.c:1355 vhci_hcd_probe()
>>> 	error: potentially dereferencing uninitialized 'vhci'.
>>>
>>> drivers/usb/usbip/vhci_hcd.c
>>>   1340          ret = usb_add_hcd(hcd_ss, 0, 0);
>>>   1341          if (ret) {
>>>   1342                  pr_err("usb_add_hcd ss failed %d\n", ret);
>>>   1343                  goto put_usb3_hcd;
>>>   1344          }
>>>   1345  
>>>   1346          usbip_dbg_vhci_hc("bye\n");
>>>   1347          return 0;
>>>   1348  
>>>   1349  put_usb3_hcd:
>>>   1350          usb_put_hcd(hcd_ss);
>>>   1351  remove_usb2_hcd:
>>>   1352          usb_remove_hcd(hcd_hs);
>>>   1353  put_usb2_hcd:
>>>   1354          usb_put_hcd(hcd_hs);
>>>   1355          vhci->vhci_hcd_hs = NULL;
>>>                 ^^^^^^^^^^^^^^^^^
>>>   1356          vhci->vhci_hcd_ss = NULL;
>>>                 ^^^^^^^^^^^^^^^^^
>>> vhci is never initialized.
>>>
>>>   1357          return ret;
>>>   1358  }
>> --
>> 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
> 
> 

--
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