Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3087342rwb; Mon, 15 Aug 2022 17:49:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR49FrrrJUpG61QpdnZZ4zW1NakEbA0HXcpAJK/f7BpLCfgBz7Z+6RSoBU+L6djCOfzxQAnf X-Received: by 2002:aa7:d657:0:b0:43e:7fe2:95d4 with SMTP id v23-20020aa7d657000000b0043e7fe295d4mr16623759edr.60.1660610957089; Mon, 15 Aug 2022 17:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610957; cv=none; d=google.com; s=arc-20160816; b=0Vvk/RRDj4UXrjz+A6GdBh/jH4Ao08eKqJK21FPoes5YGeUzfeJhQt6xEMFk4d0WZT DmnsgT3YgP85PrUwhWpetaUYJA6SGGGRJlmYEy59/gykXlv9bQs+uD3IGewzPVV1i50T dDbmqYzVHU59Mnr2+DwOkZ0wkgyNunFYKrNpayQ5lwWxL5458LJM/6no1BfAILjU8y9n 0rlBsiKrJ2j+gTr45tHbjP3mcBoe0CMbnRT3jZORgxXaC60Efi8ZbhYXCGnrD9zYIRWB XeLOL18StVqc1/GEBIlPu9v8U3fAMS0spR1ZeOGWJEdYHwbGZckqWagKTlFqlihNQaiM pH5A== 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=uGjvQQYBGzK+m/STycyXIyiW27ul/3RGT083VLRKYaAPSO+ZPjJiXLqJSrTczergl9 5vwtFPzRduaa4k4t01ZNnzwommLAqUsIO+BB5MGa9W+De5Oql5p6bFEboOyswzGZoh6O pmtRzEj4rvtdH8JsGW5bnOIcBl5kfKIlfNczLNeqSliwGPheIU8+C9Mu1ra+ttytHhGV VoidKH0M5WAC/XM+yEf128Qy+6h/tB/dCGSSfl4F+WHPnnBQGyNBAFb6UH3nn9DzkXY5 S20LFCamt0g+dKDpzpG93hS6f713kLfXMGCbnERcsU0i6SHT9/zlo2N7vtFXqa8pIzpL Kkwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OEThbSXP; 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 ne18-20020a1709077b9200b0073086ecd585si9181362ejc.625.2022.08.15.17.48.52; Mon, 15 Aug 2022 17:49:17 -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=OEThbSXP; 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 S1351848AbiHPAXx (ORCPT + 99 others); Mon, 15 Aug 2022 20:23:53 -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-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