From patchwork Wed Apr 5 13:53:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 79643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp343811vqo; Wed, 5 Apr 2023 07:19:32 -0700 (PDT) X-Google-Smtp-Source: AKy350bNzJr/JPgfYeB9jB9SywJZZ/chCZYQ7W/jbPmujrjWO0z875wJIg1MPWeDwtj4ZaadGShh X-Received: by 2002:a17:902:e80d:b0:1a1:dfb6:b804 with SMTP id u13-20020a170902e80d00b001a1dfb6b804mr7621572plg.11.1680704372480; Wed, 05 Apr 2023 07:19:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680704372; cv=none; d=google.com; s=arc-20160816; b=n+vMNYaca6BUgvF4Ue7Wj+JRXaJJfU19mfEg87fiURykVrPQ3TTpHwj9z59eEr4uLl Boil1lGveDu26TvEQ/0SwYWPkxPSwS9fyY9zMDmhTEW9szVlWhn2JJzWhXhK6kJ+YMji o8WEAQnqoSFbak+SvNkXfUHANqq/nyKlwhHuTHoLg8zT+k6AtSEw798+FZjFPv9WAJF3 S9ipzEM6DxFg+P3zDef2uhj/hGUoFtQA82gBgeNVgSlhToSwYUewfcJVi6Wuh/Ij+TTN 8TSGyrHSbo4CpyOxI91hCWERDyZVw2qQD+usn+XtyvzsxQcWktcHo7wQUfMmXYZIJXX+ jGaQ== 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=HN56+93jFXQkpc6gcQGmVk3yulxcx4JRx4yjtU47PXc=; b=RG2HowwYXFYXKL6Z+LrTIDSKpg7jOc6vPwA8B8kkGLcKVQi4atFdIfCq0VlJihAkjM UwlNZy3YV2ckxrpMNRa844uUS1gxi9wf2hiOOUFzY237nAitxntJdL+xKbd16RqieEqf 2fMtFNWjQ5SO+jMMqdpNQz9/fZEeRM/O/CgjYBSUNt27VtOXi23J1A2Rk4keg5QN9VJw pzt+w/1rfqjoSA6Xi2NfyEasWkBYMfkf/74YlIe1GPpM+qm1S3gmF9gylg7lBJYD4CNs PM7WrT+ge4g90WPSSH8NUa09enWOY1wtrzd6B8nN5J9UI83m2ZOwL0Jic12cY2RAarwd +fHg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a170903010a00b001a1799a0db6si11653403plc.63.2023.04.05.07.19.19; Wed, 05 Apr 2023 07:19:32 -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 S238225AbjDEOBK (ORCPT + 99 others); Wed, 5 Apr 2023 10:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238212AbjDEOA4 (ORCPT ); Wed, 5 Apr 2023 10:00:56 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D38336198; Wed, 5 Apr 2023 07:00:49 -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 61b86c548d00002b; Wed, 5 Apr 2023 16:00:48 +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 3CDD61B4EA5B; Wed, 5 Apr 2023 16:00:47 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Bob Moore , Kees Cook Subject: [PATCH 25/32] ACPICA: struct acpi_resource_dma: Replace 1-element array with flexible array Date: Wed, 05 Apr 2023 15:53:20 +0200 Message-ID: <4524051.cEBGB3zze1@kreacher> In-Reply-To: <4845957.31r3eYUQgx@kreacher> References: <4845957.31r3eYUQgx@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.163.219 X-CLIENT-HOSTNAME: 213.134.163.219 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejuddgjeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepledtieekkeekveeikeetgffgteeuteefjeevjeegudelvdduheeiuedvieehieevnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepvddufedrudefgedrudeifedrvdduleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduieefrddvudelpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeegpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheprhhosggvrhhtrdhmohhorhgvsehinhhtvghlrdgtohhmpdhrtghpthhtohepkhgvvghssehouhht 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762346267898683168?= X-GMAIL-MSGID: =?utf-8?q?1762346267898683168?= From: Kees Cook ACPICA commit 8409bb869a1790f6e02391c3f0eaf9c5fa63e33f Similar to "Replace one-element array with flexible-array", replace the 1-element array with a proper flexible array member as defined by C99, but without changing the structure size. 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). As with IRQs, leave a single element in a union. No binary changes appear in the .text nor .data sections. Link: https://github.com/acpica/acpica/commit/8409bb86 Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- include/acpi/acrestyp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h index 77d735594ac2..52e82d65016b 100644 --- a/include/acpi/acrestyp.h +++ b/include/acpi/acrestyp.h @@ -150,7 +150,10 @@ struct acpi_resource_dma { u8 bus_master; u8 transfer; u8 channel_count; - u8 channels[1]; + union { + u8 channel; + ACPI_FLEX_ARRAY(u8, channels); + }; }; struct acpi_resource_start_dependent {