* [PATCH] net: usb: sr9800: fix uninitialized local variable
@ 2019-10-15 20:20 Valentin Vidic
2019-10-16 4:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Valentin Vidic @ 2019-10-15 20:20 UTC (permalink / raw)
To: David S. Miller
Cc: Chuhong Yuan, linux-usb, netdev, linux-kernel, Valentin Vidic,
syzbot+f1842130bbcfb335bac1
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>
---
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(&dev->phy_mutex);
sr_set_sw_mii(dev);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: usb: sr9800: fix uninitialized local variable
2019-10-15 20:20 [PATCH] net: usb: sr9800: fix uninitialized local variable Valentin Vidic
@ 2019-10-16 4:02 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-10-16 4:02 UTC (permalink / raw)
To: vvidic
Cc: hslester96, linux-usb, netdev, linux-kernel, syzbot+f1842130bbcfb335bac1
From: Valentin Vidic <vvidic@valentin-vidic.from.hr>
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+f1842130bbcfb335bac1@syzkaller.appspotmail.com
> Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr>
Applied.
But often in situation like this a failed read can more aptly be indicated by
an all-1's value.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-16 4:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 20:20 [PATCH] net: usb: sr9800: fix uninitialized local variable Valentin Vidic
2019-10-16 4:02 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).