public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: "wanghai (M)" <wanghai38@huawei.com>
To: Johan Hovold <johan@kernel.org>
Cc: <oneukum@suse.com>, <davem@davemloft.net>, <kuba@kernel.org>,
	<netdev@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] usbnet: fix error return code in usbnet_probe()
Date: Tue, 26 Oct 2021 20:17:24 +0800	[thread overview]
Message-ID: <f7eec28b-1e4a-c03b-3503-39efff9d45ff@huawei.com> (raw)
In-Reply-To: <YXfsclAOm8Zhbac1@hovoldconsulting.com>


在 2021/10/26 19:54, Johan Hovold 写道:
> On Tue, Oct 26, 2021 at 07:25:26PM +0800, Wang Hai wrote:
>> Return error code if usb_maxpacket() returns 0 in usbnet_probe().
>>
>> Fixes: 397430b50a36 ("usbnet: sanity check for maxpacket")
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Wang Hai <wanghai38@huawei.com>
>> ---
> Good catch. This is embarrassing. I double checked the error path but
> failed to notice the missing return value.
>
>>   drivers/net/usb/usbnet.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
>> index 80432ee0ce69..fb5bf7d36d50 100644
>> --- a/drivers/net/usb/usbnet.c
>> +++ b/drivers/net/usb/usbnet.c
>> @@ -1790,6 +1790,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
>>   	dev->maxpacket = usb_maxpacket (dev->udev, dev->out, 1);
>>   	if (dev->maxpacket == 0) {
>>   		/* that is a broken device */
>> +		status = -EINVAL;
> But please use -ENODEV here. -EINVAL is typically reserved for bad user
> input.
Ok, I will send v2
>>   		goto out4;
>>   	}
> Johan
> .
>
-- 
Wang Hai


      reply	other threads:[~2021-10-26 12:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 11:25 [PATCH net] usbnet: fix error return code in usbnet_probe() Wang Hai
2021-10-26 11:54 ` Johan Hovold
2021-10-26 12:17   ` wanghai (M) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7eec28b-1e4a-c03b-3503-39efff9d45ff@huawei.com \
    --to=wanghai38@huawei.com \
    --cc=davem@davemloft.net \
    --cc=johan@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oneukum@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox