net: usb: ax88179_178a: initialize local variables before use
authorPhillip Potter <phil@philpotter.co.uk>
Thu, 1 Apr 2021 22:36:07 +0000 (23:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 May 2021 08:49:25 +0000 (10:49 +0200)
commit bd78980be1a68d14524c51c4b4170782fada622b upstream.

Use memset to initialize local array in drivers/net/usb/ax88179_178a.c, and
also set a local u16 and u32 variable to 0. Fixes a KMSAN found uninit-value bug
reported by syzbot at:
https://syzkaller.appspot.com/bug?id=00371c73c72f72487c1d0bfe0cc9d00de339d5aa

Reported-by: syzbot+4993e4a0e237f1b53747@syzkaller.appspotmail.com
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/ax88179_178a.c

index a9d0df435e2669764ee8f6724e16fb2e4a4c9150..b2434b47984685b5c7d00482e3510dab9bff29b5 100644 (file)
@@ -307,12 +307,12 @@ static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
        int ret;
 
        if (2 == size) {
-               u16 buf;
+               u16 buf = 0;
                ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0);
                le16_to_cpus(&buf);
                *((u16 *)data) = buf;
        } else if (4 == size) {
-               u32 buf;
+               u32 buf = 0;
                ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0);
                le32_to_cpus(&buf);
                *((u32 *)data) = buf;