Message ID | 20211026112526.2878177-1-wanghai38@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] usbnet: fix error return code in usbnet_probe() | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Single patches do not need cover letters |
netdev/fixes_present | success | Fixes tag present in non-next series |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 5 of 5 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Fixes tag looks correct |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 7 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | No static functions without inline keyword in header files |
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. > goto out4; > } Johan
在 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 > . >
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; goto out4; }
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> --- drivers/net/usb/usbnet.c | 1 + 1 file changed, 1 insertion(+)