Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1860795rwb; Fri, 19 Aug 2022 10:35:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5YuUlFCzizXaT4XaL2dKsoGxr0vYPhzucX5d/9bTcjmkNje4dzAJP5+8kfTOidZY5FjZcf X-Received: by 2002:a17:90b:1d90:b0:1fa:f4d7:e67d with SMTP id pf16-20020a17090b1d9000b001faf4d7e67dmr1829337pjb.162.1660930535760; Fri, 19 Aug 2022 10:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930535; cv=none; d=google.com; s=arc-20160816; b=QEr7UsZLCf5jG1ZGUADbyCNiRyB6bmLcTCmRnLKGhkmlLlJwBMUiL/B3bZZ7EIYV5B 7BKLaPLm6gyiptDp2Eyd6+CB6Mg0EK5cqA9of0D2plO7NoscsFOU/hLaZLG9vU6mRtbd YyHzGEm6VNe9xvnn8ugF9Jbg1/uu2zUGAe5QPk4cMaO8isZ665I0knqzAOyQYarx6GAF fqjABC4BCpYWrRcFOd5Ku50QS8TYAnutzDi09kCm7Fa29yRDjrPtxidmcC9kRl6SnAlA G0uT75gCOkiyTVShu6l/HMbuub6KFqQh9vWpJkpKWtdY2WSc/2x/u8m/zqYYNpcshn3X dV6Q== 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=wKab9iRyQF5nudvpq+2QiL8tIoni94Me1MO6Lc1VYI8=; b=baG8LO0gTYTZRUy4pV40mQpQVQ250CQ3O3esGwjnTZ2MOgtVmodUc7n6QeHlqvLAeH 8BE4gmIK7gMecvE26ZnTUms/21APt+iSbQmbKZCZiCP74u5OrqDuCl5HvUow5RhpkgOi 8YEcNPWfLhJSw9bK28p7QEasLGB1lDF4hZObeelrBvLFBjuaw3CmSPUl6wAu+uU/kBb+ HmkBp7eWiX5zHRTWcrMgvEVyJ3/F4FUYJgpByxI4hIWQEli9bZ9o6bXFrMG2NxdjHuwy nTB3pj7x7mf6dZGg3W2qykDoQND2wvHOBmK1SwluBJKv4edOkXliuRiyzELUeKzwbn2P hhvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SFa/F42h"; 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 c3-20020a170902d48300b0016c1fcbe411si4783963plg.195.2022.08.19.10.35.23; Fri, 19 Aug 2022 10:35:35 -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="SFa/F42h"; 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 S1352866AbiHSQZm (ORCPT + 99 others); Fri, 19 Aug 2022 12:25:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352467AbiHSQVE (ORCPT ); Fri, 19 Aug 2022 12:21:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38557F7B; Fri, 19 Aug 2022 09:02:20 -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 C75AA6177D; Fri, 19 Aug 2022 16:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E8E5C433C1; Fri, 19 Aug 2022 16:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924939; bh=8X1dscwIlPsup7vQ7QLBYq58S4MnnMJ73UZ9OiX8JUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SFa/F42hURpkNL/gl3xfbdgozggMJx/WQmVh04fDXIjk80Obx2vKqz/XRogNrKILu 9bc/+4D5fQikUCItKkU7eWyAll+x0Rwyztv81tJAafl//8k20QD87xatCZa1DYQSkS GXcpl1QegwLWnc2GawV53XhfLepujStMqCntbA6U= 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.10 330/545] interconnect: imx: fix max_node_id Date: Fri, 19 Aug 2022 17:41:40 +0200 Message-Id: <20220819153844.143944256@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 e398ebf1dbba..36f870e7b596 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