]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: fix the exception when query imp info
authorJiaran Zhang <zhangjiaran@huawei.com>
Mon, 13 Sep 2021 13:08:24 +0000 (21:08 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Sep 2021 13:25:37 +0000 (14:25 +0100)
commitcbbf445e68f65d99a9b01a2e643067194d2f4d76
treec138e807379524c55504d95b9fcc0144762f77a0
parent2f39b3acdfdaea3fa8c37b338cd4d07a2735f5b7
net: hns3: fix the exception when query imp info

When the command for querying imp info is issued to the firmware,
if the firmware does not support the command, the returned value
of bd num is 0.
Add protection mechanism before alloc memory to prevent apply for
0-length memory.

Fixes: 6917b8b2347e ("net: hns3: refactor dump m7 info of debugfs")
Signed-off-by: Jiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c