net: hns3: remediate a potential overflow risk of bd_num_list
authorGuangbin Huang <huangguangbin2@huawei.com>
Mon, 29 Mar 2021 03:57:47 +0000 (11:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:12:54 +0000 (10:12 +0200)
commitc56804f431db385d4564aee4582ac46520d44434
tree639d66b71f3c94e145bbd6ddfc98a39542d26fe7
parent286b3ff9fd98eadeea5fde7985d464254c43064a
net: hns3: remediate a potential overflow risk of bd_num_list

[ Upstream commit a2ee6fd28a190588e142ad8ea9d40069cd3c9f98 ]

The array size of bd_num_list is a fixed value, it may have potential
overflow risk when array size of hclge_dfx_bd_offset_list is greater
than that fixed value. So modify bd_num_list as a pointer and allocate
memory for it according to array size of hclge_dfx_bd_offset_list.

Signed-off-by: Guangbin Huang <huangguangbin2@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/hns3pf/hclge_main.c