From patchwork Wed Aug 21 00:50:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 13770683 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A82EFC3DA4A for ; Wed, 21 Aug 2024 00:51:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.780804.1190402 (Exim 4.92) (envelope-from ) id 1sgZZB-0008Ll-Bu; Wed, 21 Aug 2024 00:51:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 780804.1190402; Wed, 21 Aug 2024 00:51:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgZZB-0008Le-8b; Wed, 21 Aug 2024 00:51:13 +0000 Received: by outflank-mailman (input) for mailman id 780804; Wed, 21 Aug 2024 00:51:12 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sgZZA-0008LY-NZ for xen-devel@lists.xenproject.org; Wed, 21 Aug 2024 00:51:12 +0000 Received: from sin.source.kernel.org (sin.source.kernel.org [2604:1380:40e1:4800::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6ffe58fa-5f57-11ef-8776-851b0ebba9a2; Wed, 21 Aug 2024 02:51:03 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id DD8EECE0CDF; Wed, 21 Aug 2024 00:51:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72621C4AF12; Wed, 21 Aug 2024 00:50:59 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6ffe58fa-5f57-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724201460; bh=MMIPR++xC4Kxl0qx3QpEQFYibLJHZ0WBuJz0u9FG8Ls=; h=Date:From:To:Cc:Subject:From; b=YGDaaMoBOcm195MUxo0J1sIHd3EI71AAyN4+WATK/dt4PTYWPWfVin3mMWBBp2dOf vs/EMEUcopSmQQa2zLhzHID4prfpVvaR4QX5UyyiUQsU8pGvEv3tXXUw76dp+lQbj0 Q4fgMBqaFgD910RPClrfYLxCdBlTwyO/uwNb/aWWywPpimUQ6EGqeF4WGynK15UXUu D4lSfQc+TVvfq4/YtNCSmha97fuWqE48x+LhvDYxMVHnDekjiDx2MC85kdCu52RIPm RRBhVJO9X8R6MyFy6Q5oD6Zn1PGJX1Y4ARijGhafpemw57SG0/mOSHnysYCC7vc2wb aEbX0FZ3RiIoQ== Date: Tue, 20 Aug 2024 18:50:56 -0600 From: "Gustavo A. R. Silva" To: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] xen/pci: Avoid -Wflex-array-member-not-at-end warning Message-ID: MIME-Version: 1.0 Content-Disposition: inline Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a flexible structure where the size of the flexible-array member is known at compile-time, and refactor the rest of the code, accordingly. So, with this, fix the following warning: drivers/xen/pci.c:48:55: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/xen/pci.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c index 72d4e3f193af..a2facd8f7e51 100644 --- a/drivers/xen/pci.c +++ b/drivers/xen/pci.c @@ -44,15 +44,11 @@ static int xen_add_device(struct device *dev) } #endif if (pci_seg_supported) { - struct { - struct physdev_pci_device_add add; - uint32_t pxm; - } add_ext = { - .add.seg = pci_domain_nr(pci_dev->bus), - .add.bus = pci_dev->bus->number, - .add.devfn = pci_dev->devfn - }; - struct physdev_pci_device_add *add = &add_ext.add; + DEFINE_RAW_FLEX(struct physdev_pci_device_add, add, optarr, 1); + + add->seg = pci_domain_nr(pci_dev->bus); + add->bus = pci_dev->bus->number; + add->devfn = pci_dev->devfn; #ifdef CONFIG_ACPI acpi_handle handle;