提交 f6719743 编写于 作者: P Phillip Potter 提交者: Zheng Zengkai

net: usb: ax88179_178a: initialize local variables before use

stable inclusion
from stable-5.10.35
commit 2e68890993d0940cedc1f0369282256854293a93
bugzilla: 51866
CVE: NA

--------------------------------

commit bd78980b 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: NPhillip Potter <phil@philpotter.co.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b15beba2
...@@ -296,12 +296,12 @@ static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, ...@@ -296,12 +296,12 @@ static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
int ret; int ret;
if (2 == size) { if (2 == size) {
u16 buf; u16 buf = 0;
ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0); ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0);
le16_to_cpus(&buf); le16_to_cpus(&buf);
*((u16 *)data) = buf; *((u16 *)data) = buf;
} else if (4 == size) { } else if (4 == size) {
u32 buf; u32 buf = 0;
ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0); ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0);
le32_to_cpus(&buf); le32_to_cpus(&buf);
*((u32 *)data) = buf; *((u32 *)data) = buf;
...@@ -1296,6 +1296,8 @@ static void ax88179_get_mac_addr(struct usbnet *dev) ...@@ -1296,6 +1296,8 @@ static void ax88179_get_mac_addr(struct usbnet *dev)
{ {
u8 mac[ETH_ALEN]; u8 mac[ETH_ALEN];
memset(mac, 0, sizeof(mac));
/* Maybe the boot loader passed the MAC address via device tree */ /* Maybe the boot loader passed the MAC address via device tree */
if (!eth_platform_get_mac_address(&dev->udev->dev, mac)) { if (!eth_platform_get_mac_address(&dev->udev->dev, mac)) {
netif_dbg(dev, ifup, dev->net, netif_dbg(dev, ifup, dev->net,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册