Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: usb: sr9800: fix uninitialized local variable

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>

authored by

Valentin Vidic and committed by
David S. Miller
77b6d09f efb86fed

+1 -1
+1 -1
drivers/net/usb/sr9800.c
··· 335 335 static int sr_mdio_read(struct net_device *net, int phy_id, int loc) 336 336 { 337 337 struct usbnet *dev = netdev_priv(net); 338 - __le16 res; 338 + __le16 res = 0; 339 339 340 340 mutex_lock(&dev->phy_mutex); 341 341 sr_set_sw_mii(dev);