From patchwork Mon Sep 27 13:58:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 514716 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp4146088jao; Mon, 27 Sep 2021 06:59:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzt3GhLlqOuA92ctDfpJhFS80feZoW9rTmjueO8GEBrr5JZrNTpw2Ssz9reYQP4kxFO3BH/ X-Received: by 2002:a17:90b:17d0:: with SMTP id me16mr73397pjb.49.1632751140556; Mon, 27 Sep 2021 06:59:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632751140; cv=none; d=google.com; s=arc-20160816; b=eZzmmupk9hiVqJE7bGg6Qcf5ekcY4i8pw+e0n0XaRV9tHNVOsA+3REHUkMKv56R1ws FsVTErJMqIIyUEHe9XPxxZwGLiVONg2+5I0vTa7rtSPUocji2fq8ZMW/g+T57yaGAsEy RExBDLZP7HrriaAax7+lkne6UpvvU3ufp40ouUnQA+Z4OjlORayZ1E05wsED7YMXyGSr fMsQRmv8qbI3X21X9xk+5iQIcXTaw7lzHBDLDn7DwU5VKr6DmBmvIg/rIG6OWZZKWSNt sFlzKw+4clBfAs4UaWT4dR4UviNt3E7z15M+SiGYTCkuSiwxVUbgIJYLc69/1v58S3r5 Mtrw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=54Pj7BXYl9FqfPO76u9DSP0E5UPZrInfj1zJ/lDYenk=; b=IrPtSCPwPj/bGFpZ1p7zitJwOvlq6FLd46JjP5nysX2ZGZ86bZr8pXdbb41lNSrueN GVPL9m69rZKXg5zcUV0WfOJCC238Cy70RnCdGER4AkkTAdo/fcYnhT8e4HKwIPI1SAJJ H86TRGQf9RodiP04vYaSSGRaJ2YYIVixhycwY3bi3AU4Lnsc69LrMN8ULFkQT+NbOfLQ LmE79ELgGgA918dUvj+qmBGYMVbVuL/3KeZDbSLxS6JdSoDVOvXmRFyorDeNUsdsBQ0Z CnS5HFJFoXtkaEEkNgCHRgF9HJnO7dKzUBfIOzDClbX/R6NU4qyh7O5nLY2JuD9/Z/Zo 4cgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PaCxMuZ3; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k3si22551319pll.407.2021.09.27.06.59.00; Mon, 27 Sep 2021 06:59:00 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PaCxMuZ3; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234690AbhI0OAf (ORCPT + 8 others); Mon, 27 Sep 2021 10:00:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:46734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234645AbhI0OAe (ORCPT ); Mon, 27 Sep 2021 10:00:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 123F460F46; Mon, 27 Sep 2021 13:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632751136; bh=rXDXE/lV9ztJuIJrcfo0ufjzJVIQz5WYCaSugqmwOiM=; h=From:To:Cc:Subject:Date:From; b=PaCxMuZ3LY6eODYPf7LnJv+s8p8D6rwG1/Vi8HhO1hlLLeuf7i5Dm66XtPVH8AvT7 sfzu3hEx5RG9H0Jj8vhAU3p6w29JfBzzqEJ4yLyozjOVx+e/QSVuK1aAYFZ8O1y6oT 95StV/QSyno9YrKWm+F6s0nDtrF4+mENue41KReey11spVF+6SVwcd4YX5Na/vodkO gaOS+1DmubBrNYsuyWV4YjpLZq5JTJ2XEMLFe6ZU9O0Y3OGNwaNzRxISEK+rXjPia4 A2aOqKj7rXid6BVkvfghfHDe5BR4KBKv+4ADjRwPDs5Cy1anZo5lvxZAeWDtPOtrU3 BqlmQVW+EBgmw== From: Arnd Bergmann To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Arnd Bergmann Cc: Russell King , Maxime Coquelin , Ong Boon Leong , Joakim Zhang , Voon Weifeng , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: stmmac: fix off-by-one error in sanity check Date: Mon, 27 Sep 2021 15:58:29 +0200 Message-Id: <20210927135849.1595484-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann My previous patch had an off-by-one error in the added sanity check, the arrays are MTL_MAX_{RX,TX}_QUEUES long, so if that index is that number, it has overflown. The patch silenced the warning anyway because the strings could no longer overlap with the input, but they could still overlap with other fields. Fixes: 3e0d5699a975 ("net: stmmac: fix gcc-10 -Wrestrict warning") Reported-by: Russell King (Oracle) Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.29.2 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 640c0ffdff3d..fd4c6517125e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3502,7 +3502,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) /* Request Rx MSI irq */ for (i = 0; i < priv->plat->rx_queues_to_use; i++) { - if (i > MTL_MAX_RX_QUEUES) + if (i >= MTL_MAX_RX_QUEUES) break; if (priv->rx_irq[i] == 0) continue; @@ -3527,7 +3527,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) /* Request Tx MSI irq */ for (i = 0; i < priv->plat->tx_queues_to_use; i++) { - if (i > MTL_MAX_TX_QUEUES) + if (i >= MTL_MAX_TX_QUEUES) break; if (priv->tx_irq[i] == 0) continue;