Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp699807pxb; Tue, 5 Apr 2022 19:19:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze4VIj1oqSO9xWqr/uASqrOzzLBDiCBX3wv3ZnsbxXxK9DF34A9y6T9Q5HcepHMChd3VqQ X-Received: by 2002:a17:902:bc86:b0:151:ec83:4a8b with SMTP id bb6-20020a170902bc8600b00151ec834a8bmr6375310plb.69.1649211557964; Tue, 05 Apr 2022 19:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649211557; cv=none; d=google.com; s=arc-20160816; b=0EuwNPTPdWFM/BZ4Q9T2m+2Fni1BH2Vo9BavxzWe3cBtZjK/qR+bJLTY1a1lIBic3o P2Va+z3WyBdlw+rd5AHfsggiyc33MN+8VB2pNFQBkQk0uk0qG5VWZMi7o9sZ6xiLFLu1 UIndijgV4WKhnnEgqRO1XNxqG4V6/Qqc7mlagT0229PtJilF/O/D2s5M7NopRZPLJpV9 Q88/ORH/AZfjQa6w++ld9l3L6yONpjS0b4cYldtkr7MwVZ6CE9Y11zoW48BiYp554/Zk 1BJtueiwgvd2nhPdA17M98klvTQOgEqbbG1hWb4Nu+C2rzhBddC+mNkl+Kg/qwboVOxO T87w== 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=1RUefuppRPOnJxmiVWGXfvhFQMbomLLRaSLyfIh/qBw=; b=0//AQoquTDGwfWXdtGhnQ4ss9PtNqAHqTdw1yHVdypozRKE6E32fshguWYuduBeeiu hwFLS+gCe0U+Wq1wIYlJkaVbDnXHWGNnxFK7X8Niz05s69Vo/Iyv6+IYhQ+Z8eoCIN71 z9p3kk3kqKA3WjfaYTeaHe4hvGn+sPK8W76clh7Xpn2zSpr3xPfmyzwENhAkU1bkCrxe AVh8nOrWhizgTi1PkljjpUnJOQsOeLdglDHAz0axbZqkRxB3JU701DFIy7X/C4lXprEX HQKzXYkRnDhlSuoeKPV51OKEaWWazXbIQdJD97mH+Ghzsbsj5k7PalJzZIFbinzBMEMN cXLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1Q9oDFX; 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 oa6-20020a17090b1bc600b001caa6642b86si4176440pjb.28.2022.04.05.19.19.01; Tue, 05 Apr 2022 19:19:17 -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=T1Q9oDFX; 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 S1356807AbiDENIS (ORCPT + 99 others); Tue, 5 Apr 2022 09:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344060AbiDEJRW (ORCPT ); Tue, 5 Apr 2022 05:17:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AD3B20192; Tue, 5 Apr 2022 02:03:55 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BAD72614E4; Tue, 5 Apr 2022 09:03:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFAE9C385A0; Tue, 5 Apr 2022 09:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149434; bh=4xVP+rc9dkDWqE/NBcuMen4mqzFB0WGjI6QqAFNahww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1Q9oDFXx7Q10TYYQF6HatDxsJ0aXwmFvwsEmFBTy33aPzXwH4OZmuWycxdhOK5pZ sMsbTckQMX9ardQieD5gVq+0wuEe4fZ3RVfMDq/BG1U8lFse7XQHJbPYu3DOh0CNFX SVFTBhMZZPN5HMq1hPHXiQCLrw3wQdMTwIbbE0B8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Dan Carpenter , Abel Vesa , Sasha Levin Subject: [PATCH 5.16 0675/1017] clk: imx: off by one in imx_lpcg_parse_clks_from_dt() Date: Tue, 5 Apr 2022 09:26:28 +0200 Message-Id: <20220405070414.315845337@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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.1 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: Dan Carpenter [ Upstream commit 135efc3a76d127691afaf1864e4ab627bf09d53d ] The > needs to be >= to prevent an off by one access. Fixes: d5f1e6a2bb61 ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree") Reported-by: kernel test robot Signed-off-by: Dan Carpenter Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220228075014.GD13685@kili Signed-off-by: Abel Vesa Signed-off-by: Sasha Levin --- drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx8qxp-lpcg.c b/drivers/clk/imx/clk-imx8qxp-lpcg.c index b23758083ce5..5e31a6a24b3a 100644 --- a/drivers/clk/imx/clk-imx8qxp-lpcg.c +++ b/drivers/clk/imx/clk-imx8qxp-lpcg.c @@ -248,7 +248,7 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev, for (i = 0; i < count; i++) { idx = bit_offset[i] / 4; - if (idx > IMX_LPCG_MAX_CLKS) { + if (idx >= IMX_LPCG_MAX_CLKS) { dev_warn(&pdev->dev, "invalid bit offset of clock %d\n", i); ret = -EINVAL; -- 2.34.1