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:14:36 +0000 (09:14 +0200)
commitcfedc70d3c63fff1b001d5ce78a1dda86c55215a
treed725a2fee23a5a4998aaf4168a2a78fb9912ab64
parent88c39408187ce118158c6e5e981439578c1d8e1e
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