Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp726484pxj; Thu, 17 Jun 2021 12:20:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySQ7lSxTzyPgBzDr+GXWNVVC6khRpbp6UGTIQo/sULrJCOOvvcAuWuLhrlHf4B+klT53bc X-Received: by 2002:aa7:cf0a:: with SMTP id a10mr1693384edy.329.1623957652014; Thu, 17 Jun 2021 12:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623957652; cv=none; d=google.com; s=arc-20160816; b=qYiOifS/UhOEaQP5cjRO4ZA2VZdmQ6A5N2XIXIhCRvrLHnYThgyGq7afdtoqwO7feY 1EeED1L3IGPM8xGi2mQdh5A+za+2xId9bh/sWqWvb+3A+kJtFyihL2IrSMx0U5hjPWao 7pwrgRBr7jpx5qZBXs032n7wXOt6Ea8SlhQ0r6cwAlhwcs6YdmjKCeGVNvefP1i8gpAw siBTao5BgxerOowq/RJK4k93QeDTvRhJ33rA22r8l0u1S7oJqx4vaVso3UbiHhDwt2V0 cqIi+DWTR0qrtqlUcr83/i2eKDMwfBBG8KJoFFD+JAF73jhkgTNRalJx7aOfN9safMww fpoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Xla1mRRpMHvbDkqBXBnbQGsv8O0L5UaT1J+1lPg0I94=; b=j2RuR9XTquX54X9UvMHi7puko47n90uXEvMBo2XSGwo5IABg4u0j41NYfS/p8jcPyP Yto6+6ZIBeeA7DY5J4TJBfi4vcPMUG/3LawE+ULZf3Vud7Y6xYEJmMWorkgaBg3ld73v 1lMvFg3+Yqm2hV0IL7vY4lf3TdsyLXvWWVdUVG0ObIb6VNPkE5suJufd1E8WF8fz9V8k 2y6YreWKT94aWmCD8zNR/Zk28uARuZmj3AobJGcNoLPKHjD22OIa1nbwb5WoFxTEoEx6 Dw1CgJSnBwCBTCkBPITalA/SJBffe+PdQfoAp15LFe5RH49nZZD1ykShOGheZ0VEyTD5 w4Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy3si3165834ejc.519.2021.06.17.12.20.28; Thu, 17 Jun 2021 12:20:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233509AbhFQP4v (ORCPT + 99 others); Thu, 17 Jun 2021 11:56:51 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:44571 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233485AbhFQP4v (ORCPT ); Thu, 17 Jun 2021 11:56:51 -0400 X-IronPort-AV: E=Sophos;i="5.83,280,1616425200"; d="scan'208";a="84670108" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 18 Jun 2021 00:54:41 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 703694015FD2; Fri, 18 Jun 2021 00:54:39 +0900 (JST) From: Lad Prabhakar To: Geert Uytterhoeven , Dan Carpenter , Michael Turquette , Stephen Boyd Cc: Biju Das , Prabhakar , linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar Subject: [PATCH] clk: renesas: renesas-rzg2l-cpg: Fix off-by-one check in rzg2l_cpg_clk_src_twocell_get() Date: Thu, 17 Jun 2021 16:54:32 +0100 Message-Id: <20210617155432.18827-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix clock index out of range check for module clocks in rzg2l_cpg_clk_src_twocell_get(). Fixes: ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC") Reported-by: Dan Carpenter Signed-off-by: Lad Prabhakar --- drivers/clk/renesas/renesas-rzg2l-cpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/renesas/renesas-rzg2l-cpg.c b/drivers/clk/renesas/renesas-rzg2l-cpg.c index 49188f2a341a..0007cce1531e 100644 --- a/drivers/clk/renesas/renesas-rzg2l-cpg.c +++ b/drivers/clk/renesas/renesas-rzg2l-cpg.c @@ -221,7 +221,7 @@ static struct clk case CPG_MOD: type = "module"; - if (clkidx > priv->num_mod_clks) { + if (clkidx >= priv->num_mod_clks) { dev_err(dev, "Invalid %s clock index %u\n", type, clkidx); return ERR_PTR(-EINVAL); -- 2.17.1