Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp730209rwl; Wed, 5 Apr 2023 07:04:10 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/kjct80dDJUpTLJp0MJPYjwdZHH9mjBTg2rbvSvs0sJO+4+GcDfBkeYaPhqH3d4gdEzqX X-Received: by 2002:a17:906:c1c5:b0:932:83fa:d2fe with SMTP id bw5-20020a170906c1c500b0093283fad2femr3453741ejb.12.1680703450325; 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=PGB5iqLxkEyWOI0EU1Fd/eomr1Q21sHqarPuHsOuDu6WFNeKT2l2rfyDLfs14APh69 oCtDKDtrnHn4mZrlH9vH5ZLoevzTukt8lq9pau9rD1YGNtfRItBtrsUVfEUs2MuY2oC/ H5l3oeEnJy3sxXXewG3uHBr/VcBPqemyoaMmngLpQaYbcxbkWgKUcCx8XsAXD6TRtbuI vzGvOa8loMub8hZCSiwUMpGeUkUog1OpU4GQ0M3X0DpECISrgMQDkmt4IU+M4wx+747W 3x03+NQtLK9zdjx6KOvM8xJsgTXP+2X6qokKnAC7MVjUs0X9OWOlnajuPxYxv/S/EL22 /NyQ== 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=KMfaSss/ItInhJ+FJ8ETBIdDkLv1mDXDaFobnObDV0A=; b=N/qpMAfAgTxP4WwjbRc9RTvSHk6TeNhU0Y7ZKjGWg3xLZUpsqbdEaLJ9bNtQvrsGlO 3D1x540lotzxqPezi8WvONWPfLn/3BMA+knhkAUbCRf+jF7NKVQbUvJwJFIy7LqpEs2w enoVr8Q20o3hlv7b684yam+eong+/QTbT8ro/ZWFbNgVqbVMb5yC1vofDN8c82nHg2tx lBBNpolNLZwTqyiVe+gMr3i0eS+EP28QLn+Xd8te/0sy3bCp2wIDe9LiOyACxiaT3Oox Q8kwOJNXDu3rYCX8sivf4fO1KV0ILLkQGh1HxDFPG4RJAJGJA2hPzkXLEtJoWrqsJNSC f94g== 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 se22-20020a170906ce5600b0093c139fdd30si2714738ejb.848.2023.04.05.07.03.44; 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 S238354AbjDEOBp (ORCPT + 99 others); Wed, 5 Apr 2023 10:01:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238292AbjDEOBD (ORCPT ); Wed, 5 Apr 2023 10:01:03 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8838A659D; Wed, 5 Apr 2023 07:00:54 -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 dbc24bc88e5a9a01; Wed, 5 Apr 2023 16:00:52 +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 0B0B11B4EA62; Wed, 5 Apr 2023 16:00:52 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Bob Moore , Kees Cook , Dan Williams Subject: [PATCH 22/32] ACPICA: actbl2: Replace 1-element arrays with flexible arrays Date: Wed, 05 Apr 2023 15:50:18 +0200 Message-ID: <14903668.tv2OnDr8pf@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 44f1af0664599e87bebc3a1260692baa27b2f264 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). The sizeof() uses with struct acpi_nfit_flush_address and struct acpi_nfit_smbios have been adjusted to drop the open-coded subtraction of the trailing single element. The result is no binary differences in .text nor .data sections. Link: https://github.com/acpica/acpica/commit/44f1af06 Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- drivers/acpi/nfit/core.c | 2 +- include/acpi/actbl2.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 4e48d6db05eb..981f8b0f595d 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3477,7 +3477,7 @@ static __init int nfit_init(void) 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_smbios) != 9); + 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); BUILD_BUG_ON(sizeof(struct acpi_nfit_capabilities) != 16); diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index db292f325696..6d3251ea4c53 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -397,7 +397,7 @@ struct acpi_iort_node { u32 identifier; u32 mapping_count; u32 mapping_offset; - char node_data[1]; + char node_data[]; }; /* Values for subtable Type above */ @@ -453,14 +453,14 @@ struct acpi_iort_memory_access { */ struct acpi_iort_its_group { u32 its_count; - u32 identifiers[1]; /* GIC ITS identifier array */ + u32 identifiers[]; /* GIC ITS identifier array */ }; struct acpi_iort_named_component { u32 node_flags; u64 memory_properties; /* Memory access properties */ u8 memory_address_limit; /* Memory address size limit */ - char device_name[1]; /* Path of namespace object */ + char device_name[]; /* Path of namespace object */ }; /* Masks for Flags field above */ @@ -474,7 +474,7 @@ struct acpi_iort_root_complex { u32 pci_segment_number; u8 memory_address_limit; /* Memory address size limit */ u16 pasid_capabilities; /* PASID Capabilities */ - u8 reserved[1]; /* Reserved, must be zero */ + u8 reserved[]; /* Reserved, must be zero */ }; /* Masks for ats_attribute field above */ @@ -496,7 +496,7 @@ struct acpi_iort_smmu { u32 context_interrupt_offset; u32 pmu_interrupt_count; u32 pmu_interrupt_offset; - u64 interrupts[1]; /* Interrupt array */ + u64 interrupts[]; /* Interrupt array */ }; /* Values for Model field above */ @@ -975,7 +975,7 @@ struct acpi_madt_local_sapic { u8 reserved[3]; /* Reserved, must be zero */ u32 lapic_flags; u32 uid; /* Numeric UID - ACPI 3.0 */ - char uid_string[1]; /* String UID - ACPI 3.0 */ + char uid_string[]; /* String UID - ACPI 3.0 */ }; /* 8: Platform Interrupt Source */ @@ -1708,7 +1708,7 @@ struct acpi_nfit_interleave { struct acpi_nfit_smbios { struct acpi_nfit_header header; u32 reserved; /* Reserved, must be zero */ - u8 data[1]; /* Variable length */ + u8 data[]; /* Variable length */ }; /* 4: NVDIMM Control Region Structure */ @@ -1765,7 +1765,7 @@ struct acpi_nfit_flush_address { u32 device_handle; u16 hint_count; u8 reserved[6]; /* Reserved, must be zero */ - u64 hint_address[1]; /* Variable length */ + u64 hint_address[]; /* Variable length */ }; /* 7: Platform Capabilities Structure */ -- 2.35.3