Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2921505rwb; Mon, 15 Aug 2022 14:05:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR44SvrlW3UxAZFVRsRAjHG3YlLGAWVVOeYL8X8sZUzzJddWWc1E5E77CE51ldTm3saORTjD X-Received: by 2002:a05:6402:d05:b0:425:b5c8:faeb with SMTP id eb5-20020a0564020d0500b00425b5c8faebmr15621642edb.273.1660597554408; Mon, 15 Aug 2022 14:05:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597554; cv=none; d=google.com; s=arc-20160816; b=zpOi3I1TplVmVhsx/btuie20HdmHpFh6fZjjeJIwznLDb1LmyPvZCC6WTYNIdNJRCw vZ0koBB5DEoKs3Ek5UsjvN6CFMcXZgm/5YIzgz1hzBdHulsqPVz0WiVFNeRChX0M6fp8 tnmf3scDjbJcrSXx5n/SVTuwP2NUPqEO2XAjnVT6GoTErABWj6D2A+X+4Gk08Yu0kPBY gww+tmqyn87ch8arFzqzX8nIKhJZ6tYJHc7c9ChuvOypRQoArC1Kqn59fBZiMEjnqbdv M6+W0v3Qcb7Q7mMysL8OHSkELXZ827Nc0T0cUpRjR00Xm5Qzg0BV95FEPTeesyyihw8g zEwA== 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=tJBPowsv7oshVOM1vq4fcYPSL/DapT+2HRObpH/85FY=; b=OLbRjq6Gd2n4fJfdbpMYj5zNgXT1WYku0Ev3Jhhvr1IimzGMmOei7RD++NH4S4xNf8 JjzvmWvyJ4lxyqj2/viDXLSrYRgICxCEgUZEQDFldojPfaZlrSaDDu/eybHwU7y9qvRg tka5/9RovYWGkuGjfv8klw2DkKza0VkaIoNVVtZoJcmv9LcaAqZuYIylT/5oQz39nZ42 /wfDZsSZIlyOwuFwAVASacOOBgeBS66foXAtBWaDd3Qr5clBc1WIbBjKQYl3sYqHKXFr VjK2iyjOdYEwhBXuqqah9nivctHlCxLg5KqiubcTCXxYki/rFFMXk6nSQAWCA1dJteGy DRcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m5/6W4At"; 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 ft16-20020a170907801000b0072ed0d06c0csi7065975ejc.411.2022.08.15.14.05.28; Mon, 15 Aug 2022 14:05:54 -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="m5/6W4At"; 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 S244756AbiHOTY2 (ORCPT + 99 others); Mon, 15 Aug 2022 15:24:28 -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-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: 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.com 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 = &pdev->dev; struct icc_onecell_data *data; struct icc_provider *provider; - int max_node_id; + int num_nodes; int ret; /* icc_onecell_data is indexed by node_id, unlike nodes param */ - max_node_id = get_max_node_id(nodes, nodes_count); - data = devm_kzalloc(dev, struct_size(data, nodes, max_node_id), + num_nodes = get_max_node_id(nodes, nodes_count) + 1; + data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); if (!data) return -ENOMEM; - data->num_nodes = max_node_id; + data->num_nodes = num_nodes; provider = devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); if (!provider) -- 2.35.1