Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp728736rwl; Wed, 5 Apr 2023 07:03:27 -0700 (PDT) X-Google-Smtp-Source: AKy350YLcVFrKDsr2BYuU2RWYUjbwgWF+bJ2h819Ldi50XfiElgWxwVlfudWsyd0/PVVgezr2a+f X-Received: by 2002:a05:6a20:4d97:b0:d8:e59f:408c with SMTP id gj23-20020a056a204d9700b000d8e59f408cmr5480611pzb.33.1680703407113; Wed, 05 Apr 2023 07:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680703407; cv=none; d=google.com; s=arc-20160816; b=DUEZkIfaytn3kLdtJO/iZYegeI9U63VYKG6KoGNsKoHSW8OrmvQWxTdUGQszJsyw3a 4iInDsbo8StsZekmkMBty1hHVZFDVFEqcgk/oaiKzySeIlhf1P1qgPMcfkXsktjdcBjE U2KrFcgjyKswn5aI2TjyGiGEMqkgOyf0VbQaXNWCDdWyd+YZQ8vbmpNu668jgIJYgZLL qJwkxoBdL1tsLQ0gmIgE7k+VAkrrtK+f66Olg4WZy8ANtrPKpe3sEQZ10SvGfwoob7Ip QaqKSftlW70axwyhFeQOWsnjlpRKWXnhzAao+pDPs+AFUSg44koGSei89VtPF9W70TXw XPcw== 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=vecJ8liaxAOeAjtJ/0BEdJGIEdMyyXbCMhngB9aENUI=; b=rT3nc8E1B7CNKqvRfYFqABCVvAvH1l0+nw94V9Yot43FunK9mWy9Zu/bnTmqLgmnYL bHQO6IauwiukmN0YjajcdoXP98BR99ECxLZbdAmML2i7PGmN6j9MAJZTGT+envy/dvcP w5zy/btL4lijmfLN+zSVLkFBc5KBE56M3BIzLwEBu7SMraTBrweG5bjVjAC6RwLqDDgJ ClLWRVGeZUoE0dynWAIyG36RZcO+n2PkF4CW7+L1OsDuG5C94q82p0CowA/2tNCuT0XO HQXn1kKmr7wtPEhhfT/XJSHQFwoG2UAgOCcD1Rn85yKoFI7pAZBiDHIclDxBMUgMY0AE ugwg== 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 b27-20020aa7951b000000b005a8f259220asi12715612pfp.66.2023.04.05.07.03.12; Wed, 05 Apr 2023 07:03:27 -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 S238217AbjDEOBD (ORCPT + 99 others); Wed, 5 Apr 2023 10:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237218AbjDEOAz (ORCPT ); Wed, 5 Apr 2023 10:00:55 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C51759C4; Wed, 5 Apr 2023 07:00:46 -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 1656c586a3f367bf; Wed, 5 Apr 2023 16:00:44 +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 114041B4EA5B; Wed, 5 Apr 2023 16:00:43 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Bob Moore , Kees Cook Subject: [PATCH 27/32] ACPICA: acpi_dmar_andd: Replace 1-element array with flexible array Date: Wed, 05 Apr 2023 15:55:13 +0200 Message-ID: <13264075.dW097sEU6C@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: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejuddgjeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepledtieekkeekveeikeetgffgteeuteefjeevjeegudelvdduheeiuedvieehieevnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepvddufedrudefgedrudeifedrvdduleenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieefrddvudelpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeegpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhosggvrhhtrdhmohhorhgvsehinhhtvghlrdgtohhmpdhrtghpthhtohepkhgvvghssehouhht fhhluhigrdhnvght X-DCC--Metrics: v370.home.net.pl 1024; Body=4 Fuz1=4 Fuz2=4 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 3c19ae70424e9ab1e1b805203d300d2660f9a2f7 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 handling of struct acpi_dmar_andd by acpi_dm_dump_dmar() appears to expect a single trailing char for calculating table offsets. Keep a char in the union to avoid any code changes appearing in the .text or .data sections. Link: https://github.com/acpica/acpica/commit/3c19ae70 Signed-off-by: Kees Cook Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- include/acpi/actbl1.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 6ee7437537db..58b0490a2ad1 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -901,7 +901,10 @@ struct acpi_dmar_andd { struct acpi_dmar_header header; u8 reserved[3]; u8 device_number; - char device_name[1]; + union { + char __pad; + ACPI_FLEX_ARRAY(char, device_name); + }; }; /* 5: SOC Integrated Address Translation Cache Reporting Structure */ -- 2.35.3