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: 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>
This commit is contained in:
parent
123521b6b2
commit
48009e9972
@ -176,7 +176,7 @@ static int hclge_get_ring_chain_from_mbx(
|
||||
ring_num = req->msg.ring_num;
|
||||
|
||||
if (ring_num > HCLGE_MBX_MAX_RING_CHAIN_PARAM_NUM)
|
||||
return -ENOMEM;
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < ring_num; i++) {
|
||||
if (req->msg.param[i].tqp_index >= vport->nic.kinfo.rss_size) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user