Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp850582pxb; Wed, 6 Apr 2022 01:55:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweBc8bUfFLmtR5akwcyxJMTypOZTEMHpushFaVtHX4ieSyuP4JFJ5D7RdoOdE7/T8qwycr X-Received: by 2002:a17:902:8f94:b0:151:64c5:7759 with SMTP id z20-20020a1709028f9400b0015164c57759mr7660556plo.4.1649235325117; Wed, 06 Apr 2022 01:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649235325; cv=none; d=google.com; s=arc-20160816; b=VtTytQv/W3mlB6jbcDz3kcc1D7oW0V9nUOLDxOPIzcaTv0dvEL5la6liB44WwS44hR PMwg/4jm/kyBYtk1Uf9F2jV//ai+3D8eR/c8W6z6kcJZhv+0gsJyBltMqCAGDskc+wYW YTCwq2fz6OkvnDQLd8jKjKWCk6NgBIc3g3EmZu2ez8s0Qkozc6k7lrNB/IaYOniQsKD9 K193K2S5Ln5+58Nb2c9xAa4YYuUSRMIF4LKINnPZWaLePJH9KpdLt4Gh5swE1LGxynA1 MosSKSou0rV5BLpvP+Siwz8+TqB02Egg368Q1dxUgr7cpxsn6vHsJLmCHy52IxM8Z7nD mwxQ== 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=Cw4cumwEdXN2qBRJSCunVYu8Oy9QRtLNC3l3NvBNq8GSoliFlB7PpwJ4hFFQNl1+RL UWilYVupgLJMdQB/EpI9oWkwJ2K7aHaZbX08WfigfPUkEJg06G75L854Q1/CmnL/FAwB A8gk3kfVpsrKtLE7JWzMZ5pGWITh9MYWGA4ZJ0DE6i1Avw17+94bZyWSnNqWVrw1/476 6vkUkHzchVua6Md+LXtIj60f5xoMkszASAqDtTNZ8GQROqc9aZtDr1s514Nxv+36BG7f jlXV6lULn+0rXQGCQQlE39C4WIpRP/Ln2cAwB/JOvao8WL9aZ3co4ItHja8CEToDfy+T 23fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=09dUuGRU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a4-20020a170902900400b00153b2d164b9si14278588plp.193.2022.04.06.01.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 01:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=09dUuGRU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 39FD45A62AD; Wed, 6 Apr 2022 01:47:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234736AbiDEXUW (ORCPT + 99 others); Tue, 5 Apr 2022 19:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349451AbiDEJtx (ORCPT ); Tue, 5 Apr 2022 05:49:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D87D27CEE; Tue, 5 Apr 2022 02:46:23 -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 0C337B818F3; Tue, 5 Apr 2022 09:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70157C385A3; Tue, 5 Apr 2022 09:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151980; bh=4xVP+rc9dkDWqE/NBcuMen4mqzFB0WGjI6QqAFNahww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=09dUuGRUkwqJN53nR0S/OtmqltVwfHPi7SNQz7aqnhmYGwOM5+aNBPQtIdQPs+GYP Z4yTw2/OYnaE+aktU1ARF9F8sFALlAg9QfeiSuosCckECQRnMziro4iakf8gyCSvHw DjdoiSxpVFbsOLsIVfSyGN8qur65ta7r+fTR0DNg= 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.15 610/913] clk: imx: off by one in imx_lpcg_parse_clks_from_dt() Date: Tue, 5 Apr 2022 09:27:52 +0200 Message-Id: <20220405070358.126483113@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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