net: hns3: add check to number of buffer descriptors
authorWeihang Li <liweihang@hisilicon.com>
Thu, 20 Jun 2019 08:52:42 +0000 (16:52 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Jun 2019 15:59:02 +0000 (11:59 -0400)
commit987b4ae78e4268d22b279f65d80cc541f9f0eb53
treee1c46571849deb539f19d186264d1638678c7e3a
parent9d5e67d1c191831da79f0a8bcff029151e3fe54b
net: hns3: add check to number of buffer descriptors

This patch adds check to number of bds before we allocate memory for
them. If we get an invalid bd num in some cases, it will cause a memory
overflow.

Signed-off-by: Weihang Li <liweihang@hisilicon.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.h