]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: usb: sr9800: fix uninitialized local variable
authorValentin Vidic <vvidic@valentin-vidic.from.hr>
Tue, 15 Oct 2019 20:20:20 +0000 (22:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Oct 2019 04:02:12 +0000 (21:02 -0700)
Make sure res does not contain random value if the call to
sr_read_cmd fails for some reason.

Reported-by: syzbot+f1842130bbcfb335bac1@syzkaller.appspotmail.com
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/sr9800.c

index c5d4a0060124cf238543b3c9f3f9de603749a708..681e0def6356ba8d4ea6a3c0d9982d09f3c9973b 100644 (file)
@@ -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(&dev->phy_mutex);
        sr_set_sw_mii(dev);