Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2984992rwb; Mon, 15 Aug 2022 15:29:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR7qbrqaQoWLUhSsywjOHwsTi4uK3262SNIvyR8f+Cx5H4PjUPFR/6AQ0iAmYMuIPVh5+aqF X-Received: by 2002:a05:6a00:17a8:b0:52e:6e3e:9ff with SMTP id s40-20020a056a0017a800b0052e6e3e09ffmr18452469pfg.42.1660602539930; Mon, 15 Aug 2022 15:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660602539; cv=none; d=google.com; s=arc-20160816; b=upbfMBEjOGARSPMgde+ySFxh6keLiLGW38VlNbMcDvvL9URk07670u0PjGxtScPHbq lyOaHsjisAtSvjSYgrmlASBMuqzvz5HWkThILlWqBJVu9FvsXuFi8BzMLrWgGVMl2iea QL1N9N23keCEKNMyxp2TpD4vnQYqKWWOQIfPQQ2DSUSgAJtzEMvJY7RIPas1cJPk07jJ Ph5cPmdfstzcI/gQo4JOG7AaIViAWp8Nb8VFJ5oeC1abtndHDM6zxDKw7rf2qq0xYD1W EZP3PCOGUKhqh5CoCD4wtSSRxkOKwk1ZAT2DlOzApezu5XDHDnSSurakk2u0UiNWeaiW Q+2w== 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=MV9ypbfEss83DtelF59kGEPWjqrXmpMAStnWYDiB+pY=; b=QpZ0K1RlvoMNUX+fuDcDeWZD94OyCCEzun2deTNUxXQsUet/NtVGxAwvsD5koRMa1t /9ZNWG8x+wl052Nt+8/JeaS4Kz5UDM+hjzO7ydMDqB0j8XN0Y4kUMBss6cCDUiI9jRmt xLUbgdQcnGxYhLq3Rwagtkr6sel4Hkwrgl0GZcUG/HZYJlCphehyrvZZkSeh+zmZMV7T g+xy5WkAwruhk4AajDowYpy/5UcTmz9/2M/7i1FYdd0W58f3xOSb1knwyfPvTSBjSU0J 1aex2bnf60+jDq5Jdcg7YN9yjh7AQVuo7S1hOhL/mhyoeMgHfB09OnS7/b9DzuJZWU21 B67w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xcd5ZAfe; 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 x11-20020a17090ab00b00b001f19523ebadsi7824725pjq.78.2022.08.15.15.28.46; Mon, 15 Aug 2022 15:28:59 -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=Xcd5ZAfe; 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 S1350349AbiHOW0j (ORCPT + 99 others); Mon, 15 Aug 2022 18:26:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349919AbiHOWRR (ORCPT ); Mon, 15 Aug 2022 18:17:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65BBC3F313; Mon, 15 Aug 2022 12:40:40 -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 C01EC61217; Mon, 15 Aug 2022 19:40:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9D36C43470; Mon, 15 Aug 2022 19:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592423; bh=YHnaOV5Y4krgMZM6veswHxagQoNsgvH0gQzfp0blJqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xcd5ZAfeNvmAu0IIOlurHnNzaRbhtleCcmiRvztfdLL7ZK+fvpZQahqT4gSpNit6u tgJiFg7cNxJXxhjj8NQvi7e0K9FzNpWhJhyPUYfc0zqh8+JfQs3/FPJTgXQ6jTmSSB p25u947ROUD6EvyLo/comO1Y3VLNpa3hkuINYneU= 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.18 0762/1095] interconnect: imx: fix max_node_id Date: Mon, 15 Aug 2022 20:02:41 +0200 Message-Id: <20220815180500.792253160@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 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 = &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