net: usb: qmi_wwan: Add error handling for usbnet_get_ethernet_addr
Subsystems (5)
PATCH 1/1 net: usb: qmi_wwan: Add error handling for usbnet_get_ethernet_addr
In qmi_wwan_bind(), usbnet_get_ethernet_addr() is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.
Fix this issue by adding an error handling for the usbnet_get_ethernet_addr(), improving code robustness.
--- drivers/net/usb/qmi_wwan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/qmi_wwan.c +3 -1
@@ -779,7 +779,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)/* errors aren't fatal - we can live with the dynamic address */ if (cdc_ether && cdc_ether->wMaxSegmentSize) { dev->hard_mtu =le16_to_cpu (cdc_ether->wMaxSegmentSize); -usbnet_get_ethernet_addr (dev, cdc_ether->iMACAddress); + status =usbnet_get_ethernet_addr (dev, cdc_ether->iMACAddress); +if (status <0 ) + goto err; }/* claim data interface and set it up */
Signature · 1 line
2.42.0.windows.2
Quoted 9 lines · Wentao Liang
In
qmi_wwan_bind(),usbnet_get_ethernet_addr()is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.Fix this issue by adding an error handling for the
usbnet_get_ethernet_addr(), improving code robustness.Fixes 423ce8caab7e ("net: usb: qmi_wwan: New driver for Huawei QMI based WWAN devices")Signed-off-by Wentao Liang <[email protected]>
Quoted 18 lines · Wentao Liang
In
qmi_wwan_bind(),usbnet_get_ethernet_addr()is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.Fix this issue by adding an error handling for the
usbnet_get_ethernet_addr(), improving code robustness.Fixes 423ce8caab7e ("net: usb: qmi_wwan: New driver for Huawei QMI based WWAN devices")Signed-off-by Wentao Liang <[email protected]>--- drivers/net/usb/qmi_wwan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/usb/qmi_wwan.c +0
-0
drivers/net/usb/qmi_wwan.c static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) · line 787
Quoted 10 lines
drivers/net/usb/qmi_wwan.c +3
-1@@ -779,7 +779,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)/* errors aren't fatal - we can live with the dynamic address */ if (cdc_ether && cdc_ether->wMaxSegmentSize) { dev->hard_mtu =le16_to_cpu (cdc_ether->wMaxSegmentSize); -usbnet_get_ethernet_addr (dev, cdc_ether->iMACAddress); + status =usbnet_get_ethernet_addr (dev, cdc_ether->iMACAddress); +if (status <0 ) + goto err; }/* claim data interface and set it up */
Did you read the comment?
This intentinonally ignores any errors. I don't know how to make it clear anough for these AI bots to understand. Any advice there?
NAK
(and why weren't I CCed? Noticed this by chance only...)
Bjørn
Quoted 29 lines · Bjørn Mork
Quoted 27 lines · Wentao Liang
In
qmi_wwan_bind(),usbnet_get_ethernet_addr()is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.Fix this issue by adding an error handling for the
usbnet_get_ethernet_addr(), improving code robustness.Fixes 423ce8caab7e ("net: usb: qmi_wwan: New driver for Huawei QMI based WWAN devices")Signed-off-by Wentao Liang <[email protected]>--- drivers/net/usb/qmi_wwan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/usb/qmi_wwan.c +3
-1@@ -779,7 +779,9 @@ static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf)/* errors aren't fatal - we can live with the dynamic address */ if (cdc_ether && cdc_ether->wMaxSegmentSize) { dev->hard_mtu =le16_to_cpu (cdc_ether->wMaxSegmentSize); -usbnet_get_ethernet_addr (dev, cdc_ether->iMACAddress); + status =usbnet_get_ethernet_addr (dev, cdc_ether->iMACAddress); +if (status <0 ) + goto err; }
Quoted 8 lines
drivers/net/usb/qmi_wwan.c static int qmi_wwan_bind(struct usbnet *dev, struct usb_interface *intf) · line 787
Quoted 1 line
drivers/net/usb/qmi_wwan.c +0
-0/* claim data interface and set it up */ Did you read the comment?
This intentinonally ignores any errors. I don't know how to make it clear anough for these AI bots to understand. Any advice there?
The problem is not really the AI bot, but the user of the AI bot. We often see this problem, and need to teach bot drivers that the bot is just the start. The bot points out a potential issue, but it needs a human developer to verify the issue and consider what the real fix is, which might be, as in this case, a false positive and no fix is needed.
I don't know how to really fix this issue, other than try to teach the bot drivers to actually think.
Quoted 3 lines
NAK
(and why weren't I CCed? Noticed this by chance only...)
Probably the same issue. The bot driver does not know the processes, has not run the get_maintainers script. This is again part of the issue with these sorts of patched, they are often low quality and need careful review.
Andrew
Quoted 3 lines · Wentao Liang
In
qmi_wwan_bind(),usbnet_get_ethernet_addr()is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.
Hi,
unfortunately this makes no difference between a genuine IO error and the device simply providing no string. Does the device need to provide a string for the MAC in order to function?
Frankly, this patch does not look like a good idea, as it disregards the reasoning expressed in the comment seen in the code.
Regards
Oliver