From nobody Mon Sep 29 21:07:50 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 58217C00140 for ; Tue, 16 Aug 2022 00:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346415AbiHPAXy (ORCPT ); Mon, 15 Aug 2022 20:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353056AbiHPATt (ORCPT ); Mon, 15 Aug 2022 20:19:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B7F17B837; Mon, 15 Aug 2022 13:33:34 -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 20B50611D5; Mon, 15 Aug 2022 20:33:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 191FBC433C1; Mon, 15 Aug 2022 20:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595602; bh=YHnaOV5Y4krgMZM6veswHxagQoNsgvH0gQzfp0blJqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OEThbSXP+Zgq2rm8GonmX99b16n6YHS7xyBDu+3OJNmFTOtMHAX6AQECzJwHf4zeA 7haYk/jXY+ja1tuWxZhLIUSR7cCeD71BW5mwEbjxHPYN3LGdDCyadQA7+h5xb0/IHd N8aZeUDHPXnRIJ2M+IAh0Td6iN0aIIwSK7IVIQXs= 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.19 0816/1157] interconnect: imx: fix max_node_id Date: Mon, 15 Aug 2022 20:02:52 +0200 Message-Id: <20220815180512.132055124@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 249ca25d1d55..4406ec45fa90 100644 --- a/drivers/interconnect/imx/imx.c +++ b/drivers/interconnect/imx/imx.c @@ -234,16 +234,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