From nobody Sun Dec 14 06:16:11 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24961C00140 for ; Mon, 15 Aug 2022 19:24:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244261AbiHOTY3 (ORCPT ); Mon, 15 Aug 2022 15:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243891AbiHOTVm (ORCPT ); Mon, 15 Aug 2022 15:21:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13B43D5BD; Mon, 15 Aug 2022 11:40:33 -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 02746611B9; Mon, 15 Aug 2022 18:40:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A554C433D7; Mon, 15 Aug 2022 18:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588832; bh=QZTpeShZqGomUhO9hz65Uhh5sjEr5H4rDMz0+UZAq88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5/6W4AttMb90ruu57Ar4Ot0LtrpWM0q5RuI76rS2izJ3ffoRbRUrRUXWfWaSxHmN HdPytH5C+BwNZ2C9O5NcuVvktwWvXR4RSG7gAx8Skpd/ZuSmYrLEuRp/vFLwyapuRe oTCoBp+0JxRBkOc7423zuwpCQiVwc125phb0rUuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Peng Fan , Georgi Djakov , Sasha Levin Subject: [PATCH 5.15 497/779] interconnect: imx: fix max_node_id Date: Mon, 15 Aug 2022 20:02:21 +0200 Message-Id: <20220815180358.518025334@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit bd734481e172b4827af09c9ab06c51d2ab7201e6 ] max_node_id not equal to the ARRAY_SIZE of node array, need increase 1, otherwise xlate will fail for the last entry. And rename max_node_id to num_nodes to reflect the reality. Fixes: f0d8048525d7d ("interconnect: Add imx core driver") Reviewed-by: Laurent Pinchart Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/20220703091132.1412063-5-peng.fan@oss.nxp.c= om Signed-off-by: Georgi Djakov Signed-off-by: Sasha Levin --- drivers/interconnect/imx/imx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c index c770951a909c..aabd9edf2ef7 100644 --- a/drivers/interconnect/imx/imx.c +++ b/drivers/interconnect/imx/imx.c @@ -226,16 +226,16 @@ int imx_icc_register(struct platform_device *pdev, struct device *dev =3D &pdev->dev; struct icc_onecell_data *data; struct icc_provider *provider; - int max_node_id; + int num_nodes; int ret; =20 /* icc_onecell_data is indexed by node_id, unlike nodes param */ - max_node_id =3D get_max_node_id(nodes, nodes_count); - data =3D devm_kzalloc(dev, struct_size(data, nodes, max_node_id), + num_nodes =3D get_max_node_id(nodes, nodes_count) + 1; + data =3D devm_kzalloc(dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); if (!data) return -ENOMEM; - data->num_nodes =3D max_node_id; + data->num_nodes =3D num_nodes; =20 provider =3D devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); if (!provider) --=20 2.35.1