]> git.baikalelectronics.ru Git - kernel.git/commit
net: hns3: modify the return code of hclge_get_ring_chain_from_mbx
authorJie Wang <wangjie125@huawei.com>
Sun, 24 Apr 2022 12:57:23 +0000 (20:57 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Apr 2022 09:48:49 +0000 (10:48 +0100)
commit3684d75733f395ff8da645fe89752e6afe1cde1e
tree7450c17a3fe032bd08dbce5c64b0eaf033553559
parent07218e43361a8c3639b579e2f5ef80279b2cf458
net: hns3: modify the return code of hclge_get_ring_chain_from_mbx

Currently, function hclge_get_ring_chain_from_mbx will return -ENOMEM if
ring_num is bigger than HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM. It is better to
return -EINVAL for the invalid parameter case.

So this patch fixes it by return -EINVAL in this abnormal branch.

Fixes: 2c35ed4e9a52 ("net: hns3: fix for buffer overflow smatch warning")
Signed-off-by: Jie Wang <wangjie125@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_mbx.c