Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp730206rwl; Wed, 5 Apr 2023 07:04:10 -0700 (PDT) X-Google-Smtp-Source: AKy350awuE00BJewYs21vaAQu5MijHlbCV/Yv5ctkVCriMdcsCrD0Lc3gIJfvffbEOxFDFRhrPHh X-Received: by 2002:a17:907:6e0b:b0:947:d3f0:8328 with SMTP id sd11-20020a1709076e0b00b00947d3f08328mr3337627ejc.1.1680703450160; Wed, 05 Apr 2023 07:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680703450; cv=none; d=google.com; s=arc-20160816; b=sOPVpvYAGxrLd1MfqDq5yX25Xa3d31E9Q3t5b0nXkV/H/qjAMEXRooxTyxHh0sWpeJ sCIcsxqkHW1FWcYsbFXuq+BG/DcYx2XkBUhEq3Of3g0lgzN178kYK8NyQiX9MOWSD9bp CD9eIUbDssFm70cnw/IiNtEdT3XOf7sosCtpMyu12Rajv8ZGC6prKpoGSLvo/qk8rb0O fVsLbKuzd33cZg1dSYUXmUhVMgpSh3CIhpJwzuDTiXCjo+qezAYhJP2IandUNUXkHdoR iyj3SLnZkPeqXrueQlwd8Q52c+9msvY1WTn1+5IzMM3AAuWnJumkwlW1fxuKLPB5KhoL SvbA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=A6FvSd3JGFigbHlJPqVT5mg94ehGHiiiGiumNqHZu9k=; b=Z2/vkgVJtvL/CMkbai/wzc9gumBotRLrgh9sc0vUS/AzI8/zXPUZizXC4SOGhPTr8X Qbkkgpv4N9k0zbI5IW+L5Btyhvm15oyevwKzvPbNcxHlo2nB4zL2nV36xkyTTAPkkUAm 3CgRJeTqEqIU4J2rdlDm/G8fH2ve7tGElPChRZD1eGa6KyTP6MF8aQnK2o4Ydpp5vrqw E257h2eWCPHmR+hEyJb2BlRE0wKMOG04ZawicyyXSc05eXZ4MNPb5EVwq81EUPgLx3Jj Q8MvocIbYNagKCNmq9qphGZJvQIOYsWSZ3bn7ije6qAMzyopkCchw9IAWMdpf0w/Mc64 DNOg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a170906594600b0093033954892si3663934ejr.512.2023.04.05.07.03.43; Wed, 05 Apr 2023 07:04:10 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238336AbjDEOBf (ORCPT + 99 others); Wed, 5 Apr 2023 10:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238278AbjDEOBC (ORCPT ); Wed, 5 Apr 2023 10:01:02 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AB786182; Wed, 5 Apr 2023 07:00:52 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.1.0) id 2baca87f8f83e7cf; Wed, 5 Apr 2023 16:00:51 +0200 Received: from kreacher.localnet (unknown [213.134.163.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 7FD111B4EA62; Wed, 5 Apr 2023 16:00:50 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Bob Moore , Kees Cook , Dan Williams Subject: [PATCH 23/32] ACPICA: struct acpi_nfit_interleave: Replace 1-element array with flexible array Date: Wed, 05 Apr 2023 15:51:25 +0200 Message-ID: <2652195.BddDVKsqQX@kreacher> In-Reply-To: <4845957.31r3eYUQgx@kreacher> References: <4845957.31r3eYUQgx@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.163.219 X-CLIENT-HOSTNAME: 213.134.163.219 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejuddgjeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepledtieekkeekveeikeetgffgteeuteefjeevjeegudelvdduheeiuedvieehieevnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepvddufedrudefgedrudeifedrvdduleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieefrddvudelpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhosggvrhhtrdhmohhorhgvsehinhhtvghlrdgtohhmpdhrtghpthhtohepkhgvvghssehouhht fhhluhigrdhnvghtpdhrtghpthhtohepuggrnhdrjhdrfihilhhlihgrmhhssehinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: Kees Cook ACPICA commit e66decc6fca36b59194b0947d87d6a9bec078bc3 Similar to "Replace one-element array with flexible-array", replace the 1-element array with a proper flexible array member as defined by C99. This allows the code to operate without tripping compile-time and run- time bounds checkers (e.g. via __builtin_object_size(), -fsanitize=bounds, and/or -fstrict-flex-arrays=3). Unlike struct acpi_nfit_flush_address and struct acpi_nfit_smbios, which had their sizeof() uses adjusted in code, struct acpi_nfit_interleave did not. This appears to have been a bug. After this change, there is a binary difference in acpi_dm_dump_nfit() since the size of the structure now has the correct size, as the prior result was including the trailing U32: - mov $0x14,%ebp + mov $0x10,%ebp Link: https://github.com/acpica/acpica/commit/e66decc6 Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- drivers/acpi/nfit/core.c | 2 +- include/acpi/actbl2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 981f8b0f595d..a398f32dfd68 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3476,7 +3476,7 @@ static __init int nfit_init(void) BUILD_BUG_ON(sizeof(struct acpi_table_nfit) != 40); BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 64); BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48); - BUILD_BUG_ON(sizeof(struct acpi_nfit_interleave) != 20); + BUILD_BUG_ON(sizeof(struct acpi_nfit_interleave) != 16); BUILD_BUG_ON(sizeof(struct acpi_nfit_smbios) != 8); BUILD_BUG_ON(sizeof(struct acpi_nfit_control_region) != 80); BUILD_BUG_ON(sizeof(struct acpi_nfit_data_region) != 40); diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 6d3251ea4c53..a51fd4090d27 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -1700,7 +1700,7 @@ struct acpi_nfit_interleave { u16 reserved; /* Reserved, must be zero */ u32 line_count; u32 line_size; - u32 line_offset[1]; /* Variable length */ + u32 line_offset[]; /* Variable length */ }; /* 3: SMBIOS Management Information Structure */ -- 2.35.3