Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3766080ybi; Mon, 27 May 2019 05:44:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNj13hBS2U4cOkHEuzVEW7tbTGbcck+zPQe3Q69NtDk2Pwq6YlVdq/f5y+LQoN9u2GT33G X-Received: by 2002:a65:610a:: with SMTP id z10mr30187801pgu.54.1558961051826; Mon, 27 May 2019 05:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558961051; cv=none; d=google.com; s=arc-20160816; b=RszM/tdp++CjkEu3D+2fIBB6ZtQ3ftH0uSvh/eR89vne2mbogX6elOw5N2C/CuMm8D aUSvGEtHOOIDoo67FDgqFlp+YVhZmSz9h4RBqYW3vrg/6u5ehxhzbfWPuYY9vHuV99Sb 82UeQJUX6gmBNbl38vTQ5plKAgh7wDAND5w5ofDx19+Xt8/fD/7/pH8Qrju0DpUMBwt6 bRZ8p4DCByYJH71IBWvJILKsJ431CSULxcw04/e+GwmYjN0t23Q74fIz5e2GMW2MZZJW x+wH5MtSVOtKRrj72R1t6WT1phH1ZXFJkWbz7CwgbnZg8uzTb8L7/Qh8cALZfSLOzDWw XSjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=B+veQyIHZuItZt2/1hmLcQkS3SMlrowB6ltoLMIohEQ=; b=t0eITioRGqAFyCRLUDo5KxAPjXO+bDsIehBEU1nXH4AE8tEXJBonGZbTaDLODZxdy0 2M4XseZHBkhjVi/dbsIn3oYUHJsdvH6DcyRHCSTRoK8Gs9ctq8/RHmsxJWIjlkQM6cQI KoRbhGo4YaRqX+YuMoB1/tH3kFf7BglkaDDM4NuOWmXFIhr9u5bP2ElOKO/tfz9r10nJ 3uTHqtRAA6yKc+KVp+EXE/NnUjHLs5+A4jcrfR1hWpjbRcRgvYujCnnVQaNjsbYHk4iH 4zW03GZMtxsgnM003lnCDj5gAzlxzSvMQ1Iy8/snkzCuOK0x84PEq+6Q0PcDgfPoDg// Qudg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cl12si19183379plb.7.2019.05.27.05.43.55; Mon, 27 May 2019 05:44:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbfE0LwT (ORCPT + 99 others); Mon, 27 May 2019 07:52:19 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:47489 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbfE0LwT (ORCPT ); Mon, 27 May 2019 07:52:19 -0400 X-Originating-IP: 90.88.147.134 Received: from mc-bl-xps13.lan (aaubervilliers-681-1-27-134.w90-88.abo.wanadoo.fr [90.88.147.134]) (Authenticated sender: maxime.chevallier@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 694F6E000B; Mon, 27 May 2019 11:52:13 +0000 (UTC) From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Antoine Tenart , thomas.petazzoni@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, mw@semihalf.com, Russell King , linux-arm-kernel@lists.infradead.org, kbuild test robot , Dan Carpenter Subject: [PATCH net-next] net: mvpp2: cls: Check RSS table index validity when creating a context Date: Mon, 27 May 2019 13:52:01 +0200 Message-Id: <20190527115201.12721-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make sure we don't use an out-of-bound index for the per-port RSS context array. As of today, the global context creation in mvpp22_rss_context_create will prevent us from reaching this case, but we should still make sure we are using a sane value anyway. Reported-by: kbuild test robot Reported-by: Dan Carpenter Signed-off-by: Maxime Chevallier --- drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c index cd0daad011ce..bd19a910dc90 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c @@ -1466,6 +1466,9 @@ int mvpp22_port_rss_ctx_create(struct mvpp2_port *port, u32 *port_ctx) break; } + if (i == MVPP22_N_RSS_TABLES) + return -EINVAL; + port->rss_ctx[i] = rss_ctx; *port_ctx = i; -- 2.20.1