Skip to content

Commit a092b72

Browse files
himadricsdavem330
authored andcommitted
net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
The buffer size is 2 Bytes and we expect to receive the same amount of data. But sometimes we receive less data and run into uninit-was-stored issue upon read. Hence modify the error check on the return value to match with the buffer size as a prevention. Reported-and-tested by: [email protected] Signed-off-by: Himadri Pandya <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5875568 commit a092b72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/usb/asix_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ int asix_read_phy_addr(struct usbnet *dev, int internal)
296296

297297
netdev_dbg(dev->net, "asix_get_phy_addr()\n");
298298

299-
if (ret < 0) {
299+
if (ret < 2) {
300300
netdev_err(dev->net, "Error reading PHYID register: %02x\n", ret);
301301
goto out;
302302
}

0 commit comments

Comments
 (0)