Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3105196iob; Fri, 6 May 2022 19:01:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLxoB5HBdX11XS2JXF6cMPEYq5sqaTYpjIKyjM71gq7TNbdLjVkhZjHECbJh88JH+TSEQE X-Received: by 2002:a17:903:2495:b0:15a:a0f7:d779 with SMTP id p21-20020a170903249500b0015aa0f7d779mr6567927plw.163.1651888866642; Fri, 06 May 2022 19:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651888866; cv=none; d=google.com; s=arc-20160816; b=j1sukjX8FnR6fdLiJ7tCOxTW1d9SRtWhjlpFQye+ht0sVvjhuaRrmj6ATRBibgOxY1 Fz7XgfrNFYNd5YzrEQbdrbMKW5MtEt3cFDmuTIDXYYEe8tzIxZVJeNPKdaMI9m2T/KkS hCNwHL37TGh+9eOS5CwfxsMSBxjjRnM6fK9xpgx7PIbIRC/ThIhtrs8HYZU28DUcdv4B aYq0cpWGTKACcz340z16Nz12pwX6C1wYv/l0W0ZV7oFiC6+xD6ly9zHj2ebva3xeWQnV I3daoUtelB91AiZZuVvmABdj4897s9879JBdijEbYn/7CmVXfF3TSPsdzX9uXbc/+hQ1 Sp9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y79R7p3CnQX/ilZZcyarOO/Pnkyr6hibiINdYzwoQ2k=; b=q57K03ROd0+vSVZRqANRd7keNKTb1G+b1QIVN1M6TaxBUSYCxUf0aUJ2dcD2yya1xA KT+J+TYOUgs6qC30RciaDMGsJ1JNFyc+fXfG75vaMCeshrgUvW2fKI22MrlSeHrVZuFs jGpSk2yo68NUE+PwRY1JxoAtFNX0EE9ezi/rJSCx8CcWEC12b2W4Feof8hSXppF9tmgL ls+ocL+MshOxuiDuLsOU3f0vWWhkyk2dmOExjyqOwyQ2yOdfgK57MWq2kyZNexEkf6KH niVERafkNnb77ogkHACtBqe4MRJ4YodN/AqfzydWNtasm1NR4tPod+QmDB82hKUw264h is7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J05c/Gw3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x33-20020a17090a6c2400b001dc069321b0si5949361pjj.161.2022.05.06.19.00.51; Fri, 06 May 2022 19:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J05c/Gw3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356353AbiEDRSq (ORCPT + 99 others); Wed, 4 May 2022 13:18:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356114AbiEDREy (ORCPT ); Wed, 4 May 2022 13:04:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5456E4FC7D; Wed, 4 May 2022 09:53:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C7769B827A1; Wed, 4 May 2022 16:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 713E8C385A5; Wed, 4 May 2022 16:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683229; bh=8R1bqNa1LrPBpaMM7GYTDfIzchc+vEeUxh2iMxqtLKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J05c/Gw357TGMTZRWq7IKYcl8KbG/EkUk9JsFtwN7c0b+I6HcRvP6ZTVvejyY0OCT yg5wubs9b6DbEL0w3FtwpL/dEoOTqbF/JCjaR8HT4Sp2nm5c/WdbdAp59khGErdfgK ZB0AK1vR26opXD5iyWCripkoo6l1+/U1Z2IFq2jU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Wang , Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 094/177] net: hns3: modify the return code of hclge_get_ring_chain_from_mbx Date: Wed, 4 May 2022 18:44:47 +0200 Message-Id: <20220504153101.516125357@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jie Wang [ 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 Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index 65d78ee4d65a..e30bf3027375 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -175,7 +175,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) { -- 2.35.1