Re: [PATCH] net: usb: sr9800: fix uninitialized local variable

2019-10-15 Thread David Miller
From: Valentin Vidic 
Date: Tue, 15 Oct 2019 22:20:20 +0200

> Make sure res does not contain random value if the call to
> sr_read_cmd fails for some reason.
> 
> Reported-by: syzbot+f1842130bbcfb335b...@syzkaller.appspotmail.com
> Signed-off-by: Valentin Vidic 

Applied.

But often in situation like this a failed read can more aptly be indicated by
an all-1's value.


[PATCH] net: usb: sr9800: fix uninitialized local variable

2019-10-15 Thread Valentin Vidic
Make sure res does not contain random value if the call to
sr_read_cmd fails for some reason.

Reported-by: syzbot+f1842130bbcfb335b...@syzkaller.appspotmail.com
Signed-off-by: Valentin Vidic 
---
 drivers/net/usb/sr9800.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index c5d4a0060124..681e0def6356 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -335,7 +335,7 @@ static void sr_set_multicast(struct net_device *net)
 static int sr_mdio_read(struct net_device *net, int phy_id, int loc)
 {
struct usbnet *dev = netdev_priv(net);
-   __le16 res;
+   __le16 res = 0;
 
mutex_lock(>phy_mutex);
sr_set_sw_mii(dev);
-- 
2.20.1