Skip to content

Commit

Permalink
net: hns3: fix variable may not initialized problem in hns3_init_mac_…
Browse files Browse the repository at this point in the history
…addr()

[ Upstream commit dbd2f3b ]

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: 76ad4f0 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
liuyonglong86 authored and gregkh committed Nov 28, 2023
1 parent 07f5b8c commit f47c6fb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -5139,7 +5139,7 @@ static int hns3_init_mac_addr(struct net_device *netdev)
struct hns3_nic_priv *priv = netdev_priv(netdev);
char format_mac_addr[HNAE3_FORMAT_MAC_ADDR_LEN];
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)
Expand Down

0 comments on commit f47c6fb

Please sign in to comment.