From: Jakub Kicinski <kuba@kernel.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Michael Chan <michael.chan@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Potnuri Bharat Teja <bharat@chelsio.com>,
Christian Benvenuti <benve@cisco.com>,
Satish Kharat <satishkh@cisco.com>,
Manish Chopra <manishc@marvell.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, Kees Cook <kees@kernel.org>
Subject: Re: [PATCH v2 1/2][next] UAPI: ethtool: Use __struct_group() in struct ethtool_link_settings
Date: Sat, 9 Nov 2024 10:02:13 -0800 [thread overview]
Message-ID: <20241109100213.262a2fa0@kernel.org> (raw)
In-Reply-To: <9e9fb0bd72e5ba1e916acbb4995b1e358b86a689.1730238285.git.gustavoars@kernel.org>
On Tue, 29 Oct 2024 15:55:35 -0600 Gustavo A. R. Silva wrote:
> Use the `__struct_group()` helper to create a new tagged
> `struct ethtool_link_settings_hdr`. This structure groups together
> all the members of the flexible `struct ethtool_link_settings`
> except the flexible array. As a result, the array is effectively
> separated from the rest of the members without modifying the memory
> layout of the flexible structure.
>
> This new tagged struct will be used to fix problematic declarations
> of middle-flex-arrays in composite structs[1].
Possibly a very noob question, but I'm updating a C++ library with
new headers and I think this makes it no longer compile.
$ cat > /tmp/t.cpp<<EOF
extern "C" {
#include "include/uapi/linux/ethtool.h"
}
int func() { return 0; }
EOF
$ g++ /tmp/t.cpp -I../linux -o /dev/null -c -W -Wall -O2
In file included from /usr/include/linux/posix_types.h:5,
from /usr/include/linux/types.h:9,
from ../linux/include/uapi/linux/ethtool.h:18,
from /tmp/t.cpp:2:
../linux/include/uapi/linux/ethtool.h:2515:24: error: ‘struct ethtool_link_settings::<unnamed union>::ethtool_link_settings_hdr’ invalid; an anonymous union may only have public non-static data members [-fpermissive]
2515 | __struct_group(ethtool_link_settings_hdr, hdr, /* no attrs */,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
I don't know much about C++, tho, so quite possibly missing something
obvious.
next prev parent reply other threads:[~2024-11-09 18:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 21:55 [PATCH v2 0/2][next] UAPI: net/ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2024-10-29 21:55 ` [PATCH v2 1/2][next] UAPI: ethtool: Use __struct_group() in struct ethtool_link_settings Gustavo A. R. Silva
2024-11-09 18:02 ` Jakub Kicinski [this message]
2024-11-09 18:49 ` Jakub Kicinski
2024-11-11 22:22 ` Gustavo A. R. Silva
2024-11-13 1:08 ` Gustavo A. R. Silva
2024-11-15 20:38 ` Kees Cook
2024-12-05 16:49 ` Nick Desaulniers
[not found] ` <CANtHk4mnjE5aATk2r8uOsyLKm+7-tbEv5AaXVWGP_unhLNEvsg@mail.gmail.com>
2024-12-09 21:10 ` Jakub Kicinski
[not found] ` <CANtHk4kM-9BDCm69+z3hS58uCrjCmma0aQ+nOqFUROaFhLAkDg@mail.gmail.com>
2024-12-09 21:39 ` Gustavo A. R. Silva
[not found] ` <CANtHk4nyP8HyYMobB76z9LpbA_jD=fLkWtyK9w_aMkzP8iB7Cg@mail.gmail.com>
2024-12-12 17:29 ` Kees Cook
2024-10-29 21:58 ` [PATCH v2 2/2][next] net: ethtool: Avoid thousands of -Wflex-array-member-not-at-end warnings Gustavo A. R. Silva
2024-11-03 19:20 ` [PATCH v2 0/2][next] UAPI: net/ethtool: " patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241109100213.262a2fa0@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=benve@cisco.com \
--cc=bharat@chelsio.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manishc@marvell.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=satishkh@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.