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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 May 2022 07:05:04 +0000 (09:05 +0200)
commite3ec78d82d4817992730c7789542a7b342467377
tree5e376b1f0f73174a310692e13c884d1280367dd8
parent06a40e71053a6c82bc0dd1b343c7cb2127df2068
net: hns3: modify the return code of hclge_get_ring_chain_from_mbx

[ Upstream commit 48009e9972974c52a5f649f761862dd67bce3d13 ]

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: 5d02a58dae60 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c