Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77236275 authored by Yonglong Liu's avatar Yonglong Liu Committed by Greg Kroah-Hartman
Browse files

net: hns3: fix variable may not initialized problem in hns3_init_mac_addr()



[ Upstream commit dbd2f3b20c6ae425665b6975d766e3653d453e73 ]

When a VF is calling hns3_init_mac_addr(), get_mac_addr() may
return fail, then the value of mac_addr_temp is not initialized.

Fixes: 76ad4f0e ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Signed-off-by: default avatarJijie Shao <shaojijie@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 14c6cd41
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3773,7 +3773,7 @@ static int hns3_init_mac_addr(struct net_device *netdev, bool init)
{
	struct hns3_nic_priv *priv = netdev_priv(netdev);
	struct hnae3_handle *h = priv->ae_handle;
	u8 mac_addr_temp[ETH_ALEN];
	u8 mac_addr_temp[ETH_ALEN] = {0};
	int ret = 0;

	if (h->ae_algo->ops->get_mac_addr && init) {