From patchwork Wed Feb 1 02:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alexey V. Vissarionov" X-Patchwork-Id: 651038 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 2B8AEC636D3 for ; Wed, 1 Feb 2023 02:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbjBACMh (ORCPT ); Tue, 31 Jan 2023 21:12:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbjBACMg (ORCPT ); Tue, 31 Jan 2023 21:12:36 -0500 Received: from air.basealt.ru (air.basealt.ru [194.107.17.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 913ED59E57 for ; Tue, 31 Jan 2023 18:12:20 -0800 (PST) Received: by air.basealt.ru (Postfix, from userid 490) id CFC962F20227; Wed, 1 Feb 2023 02:12:17 +0000 (UTC) Received: from localhost (broadband-188-32-10-232.ip.moscow.rt.ru [188.32.10.232]) by air.basealt.ru (Postfix) with ESMTPSA id 331322F2022B; Wed, 1 Feb 2023 02:12:16 +0000 (UTC) Date: Wed, 1 Feb 2023 05:12:13 +0300 From: "Alexey V. Vissarionov" To: Lorenzo Pieralisi Cc: Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, lvc-project@linuxtesting.org, gremlin@altlinux.org Subject: [PATCH] ACPI/IORT: Increase allocation size up to sizeof(struct acpi_iort_node) Message-ID: <20230201021213.GC446@altlinux.org> MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The node is a pointer to struct acpi_iort_node, so it's just 4 or 8 bytes, while the structure itself is several times bigger. Found by ALT Linux Team (altlinux.org) and Linux Verification Center (linuxtesting.org) using SVACE. Signed-off-by: Alexey V. Vissarionov Fixes: 24e516049360 ("ACPI/IORT: Add support for PMCG") diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index 38fb84974f352cc8..edb94b52bf3a21ce 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1832,7 +1832,8 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node, if (ops->dev_add_platdata) ret = ops->dev_add_platdata(pdev); else - ret = platform_device_add_data(pdev, &node, sizeof(node)); + ret = platform_device_add_data(pdev, &node, + sizeof(struct acpi_iort_node)); if (ret) goto dev_put;