Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp414339lqh; Thu, 28 Mar 2024 06:08:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfKKXdSlkxoZnx/1bQngdc/HkD1JS8sKAxqaDCAzeaJdGj79cqJWme/bOzaJc5+cbtu4WFXEvdGGkWpP6KaZf+P5cvbEsHWiYhQZUTDQ== X-Google-Smtp-Source: AGHT+IFSsLYhKnMlaHrPegU7RII3TQX0iQdYv6LxZl0V35C9Mvf7xez+rPEP+g01uVET8pwF+IEM X-Received: by 2002:a05:6214:188f:b0:696:b0dd:5029 with SMTP id cx15-20020a056214188f00b00696b0dd5029mr2677555qvb.31.1711631301554; Thu, 28 Mar 2024 06:08:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711631301; cv=pass; d=google.com; s=arc-20160816; b=WgbwLodjMQ8dcDlfnuLs53qOjwrrWnR3IWVkHRp5QXq9AYpckGgvynBd6luRQ2H/N1 L2vQebxxpfck2VZzVTF2BrzUnJHbkbG353gIVYcHJ+5Yx9Kq6v3dCQ60x5tBl2eS/R++ F4rJVKkBAl9ZcZViD+0RIbQKt5bVIC0Zo4lxMP2Mh/dj54U/Pu0LuU7lVVmeSoyo0l6j j/d3SdeWxB+GcZiDAJoaMlXVOYwLq/xhtrjSL5qXNyvMapn4LHZ1lUksSd6LoDmPKvIi j/OuOSBpcbzItMnsdjJIAJUvbIwhOZdIA00cT068Ya826zElZHFyvXj7EfO+6s0n9fHU IFOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=yBIxfghVXNyvYyYiaBBuu7JoGSxAoWzqa4wnk0yyrAQ=; fh=T+tkQaph9vVep5A2o1Rd2R33bARJOjqW9wvX+o5btGs=; b=xBiKyf2o6W+OB1cPep6tc6Vzj1ZSnUwO37RXOy8oOEA+S+2Dz/x+IKBfoUJIWp1uJ+ N3HvTZToVaBWf3v3XMcgVDTvh1Tt2h3UpuGuYFysfTZViF9bgwPpbq2YVpnEXytjU6ap QVsqAk/qtoHFX6gWz9JLBQm/as0XDx9XCTSSXXkN9xJ4mAnhsr4pR4+dJ6RLz+YE43C7 3F4PnbsoVW6gVWBewIAK0mnvTWu31uqHSNQHajeKQbSFgkkt+Q43cniwk11bigF4e/sc Ec2GDlhhp9c4YS6OsBC0dVrORxyi1aK/4ANCRHQDYQeFcXOITMYYSB8cJuS6ArfPUilk UabA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UjkKoVwQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-5454-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b1-20020a0c9b01000000b0069692dc6ddcsi1396459qve.9.2024.03.28.06.08.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 06:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5454-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UjkKoVwQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-5454-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5454-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D00711C2648D for ; Thu, 28 Mar 2024 13:08:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64E4C7F7F6; Thu, 28 Mar 2024 13:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UjkKoVwQ" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36B2F7F488; Thu, 28 Mar 2024 13:08:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711631297; cv=none; b=kDvuIf1nZ/07VHUV4ymiEtrb0ZiriSmWGCOTbekox+myatvTsVssEXg9seh4DLFeOXUuXSRCPdndH86dQi8Asfjn0sX1DCTzwID6L+vyKaYzHP+WNMzFWS4f/aBMi8U1SODHPnzJarZu67W2BX5B2gMaIHeAXIO9daLIMB5YdmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711631297; c=relaxed/simple; bh=nShQvEWBHWFkHeUvTXhbDAYLvFW0P8doKSZGdt8MvuI=; h=Content-Type:MIME-Version:Subject:From:In-Reply-To:References:To: Cc:Message-ID:Date; b=AN+B38ojtv3Ujho8R+2H2ShpcG2e92/oriDFEeRbbLlNnyqqQ3OVhdcjWDUC5obwmoE5sBNOTOz05mze7DKPbopsbSjo/AQaEg1spUXis0Ey5+tuNpIRIuKrf3eUwUGA7zL2km0ib/PDNKdZgPpAqz0KycHseqEvuSIvoOIj7Es= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UjkKoVwQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0484C433F1; Thu, 28 Mar 2024 13:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711631296; bh=nShQvEWBHWFkHeUvTXhbDAYLvFW0P8doKSZGdt8MvuI=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=UjkKoVwQrROwSq73YwDIuiTrCSQZORLenJpjokIRrD+XNzf3/uY7PHRmSYY1ZSn6T 12IOGyhNLap82s6+lHGUDUSUrFP+0B/+y5nXKiAuV0D+KCAeptqdKxdqZMNpWDiqCY sHxZK6L4XBO350+Z+l4t4Vgh3B8hqB0GO9fjJRmfswFYO1rNM/5aiKD1dfCFkvIUIU jHCaYGFeZjE1tNoypMRBvuvWqIEzADfty3RXOBCkZn2XRrwl35A0QqthJjsHJhYISU hccPxmrYw/QdBp9kTbxlmqfrkeak/6Bs4To9Mis8+JhsYb7nGoUP5QUne1xf1bTq1+ bSNYo1WaqVmhg== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH][next] wifi: mwl8k: Avoid -Wflex-array-member-not-at-end warnings From: Kalle Valo In-Reply-To: References: To: "Gustavo A. R. Silva" Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <171163129374.129280.17590412225670656069.kvalo@kernel.org> Date: Thu, 28 Mar 2024 13:08:15 +0000 (UTC) "Gustavo A. R. Silva" wrote: > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > There is currently an object (`header`), at the beginning of multiple > structures, that contains a flexible structure (`struct mwl8k_cmd_pkt`), > for example: > > struct mwl8k_cmd_get_hw_spec_sta { > struct mwl8k_cmd_pkt header; > > ... > > __le32 num_tx_desc_per_queue; > __le32 total_rxd; > } __packed; > > So, in order to avoid ending up with flexible-array members in the > middle of multiple other structs, we use the `__struct_group()` helper > to separate the flexible array from the rest of the members in the > flexible structure: > > struct mwl8k_cmd_pkt { > __struct_group(mwl8k_cmd_pkt_hdr, hdr, __packed, > > ... the rest of the members > > ); > char payload[]; > } __packed; > > With the change described above, we now declare objects of the type of > the tagged struct, in this case `struct mwl8k_cmd_pkt_hdr`, without > embedding flexible arrays in the middle of another struct: > > struct mwl8k_cmd_get_hw_spec_sta { > struct mwl8k_cmd_pkt_hdr header; > > ... > > __le32 num_tx_desc_per_queue; > __le32 total_rxd; > } __packed; > > Also, update the type of a couple of variables and function parameters > from `struct mwl8k_cmd_pkt` to `struct mwl8k_cmd_pkt_hdr`. > > So, with these changes, fix 33 of the following warnings[1]: > drivers/net/wireless/marvell/mwl8k.c:2353:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] > > Link: https://gist.github.com/GustavoARSilva/7a841a92c0f24e5efdb30ce02b601eb8 [1] > Link: https://github.com/KSPP/linux/issues/202 > Signed-off-by: Gustavo A. R. Silva Patch applied to wireless-next.git, thanks. 5c4250092fad wifi: mwl8k: Avoid -Wflex-array-member-not-at-end warnings -- https://patchwork.kernel.org/project/linux-wireless/patch/ZgDrhe5pbV/WvDiZ@neat/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches