OSDN Git Service

net: hns3: Check variable is valid before assigning it to another
authorYonglong Liu <liuyonglong@huawei.com>
Wed, 20 Feb 2019 02:32:41 +0000 (10:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Dec 2019 19:35:34 +0000 (20:35 +0100)
commit84d3454ee8bdc29ef2e4bee91aeed79499165b61
treeb5bccc184b3925c648ae9f11847817fe3b437a5a
parent1f10b277ffd095e3acd7b290b1a109a7afe33fe9
net: hns3: Check variable is valid before assigning it to another

[ Upstream commit 676131f7c53ecdd79e29fc8cfcdefe6f9f2485e8 ]

In hnae3_register_ae_dev(), ae_algo->ops is assigned to ae_dev->ops
before check that ae_algo->ops is valid.

And in hnae3_register_ae_algo(), missing check for ae_algo->ops.

This patch fixes them.

Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hnae3.c