From: Johannes Berg <johannes@sipsolutions.net>
To: Masashi Honma <masashi.honma@gmail.com>, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v8 3/6] wifi: mac80211: Use struct instead of macro for PERR frame
Date: Thu, 28 May 2026 10:00:08 +0200 [thread overview]
Message-ID: <8ab957b3c31dec7be844ea9e1ac2fbb2fdcd8278.camel@sipsolutions.net> (raw)
In-Reply-To: <20260521225842.31815-3-masashi.honma@gmail.com> (sfid-20260522_005855_718104_C5CA026D)
Hi,
So I was just about to apply this set, but now I'm thinking about this:
> +struct ieee80211_mesh_hwmp_perr_dst {
> + u8 flags;
> + u8 addr[ETH_ALEN];
> + __le32 sn;
> + /* optional Destination External Address */
> + u8 variable[];
> +} __packed;
This has a variable member, and the presence of the address in
'variable' depends on the flags (AE_F set there.)
> +struct ieee80211_mesh_hwmp_perr {
> + u8 ttl;
> + u8 number_of_dst;
> + struct ieee80211_mesh_hwmp_perr_dst dsts[];
> +} __packed;
However this declares an array of these, and that doesn't really seem
right. It effectively puts non-variable fields (e.g. dsts[1].ttl) after
the variable field dsts[0].variable. I _think_ some compilers (versions)
will also (rightfully) complain about this.
It seems like this should just be
struct ... {
u8 ttl;
u8 number_of_dst;
/* list of variably sized struct ieee80211_mesh_hwmp_perr_dst
*/
u8 dsts[];
} __packed;
> +static inline u16
> +ieee80211_mesh_hwmp_perr_get_rcode(const u8 *ie, u8 dst_idx)
> +{
> + struct ieee80211_mesh_hwmp_perr *perr_ie = (void *)ie;
> + struct ieee80211_mesh_hwmp_perr_dst *dst =
> + &perr_ie->dsts[dst_idx];
And especially this indexing doesn't seem like it could work - you have
to walk through all of them to see if each has the AE_F set and skip
sizeof() + optional ETH_ALEN.
> +
> + return get_unaligned_le16(&dst->variable[
> + (dst->flags & AE_F) ? ETH_ALEN : 0]);
This looks like the comment above should be
/* optional Destination External Address, rcode */
u8 variable[];
or so?
> + target_rcode = ieee80211_mesh_hwmp_perr_get_rcode(perr_elem, 0);
but evidently, this doesn't really matter right now if only one
destination entry is ever read.
Still, please fix that, if only to avoid the compiler warnings I'm
imagining will happen.
johannes
next prev parent reply other threads:[~2026-05-28 8:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 22:58 [PATCH v8 1/6] wifi: mac80211: Use struct instead of macro for PREQ frame Masashi Honma
2026-05-21 22:58 ` [PATCH v8 2/6] wifi: mac80211: Use struct instead of macro for PREP frame Masashi Honma
2026-05-21 22:58 ` [PATCH v8 3/6] wifi: mac80211: Use struct instead of macro for PERR frame Masashi Honma
2026-05-28 8:00 ` Johannes Berg [this message]
2026-05-29 23:06 ` Masashi Honma
2026-05-21 22:58 ` [PATCH v8 4/6] wifi: mac80211: Fix overread in PREQ frame processing Masashi Honma
2026-05-28 8:04 ` Johannes Berg
2026-05-29 23:06 ` Masashi Honma
2026-05-21 22:58 ` [PATCH v8 5/6] wifi: mac80211: Fix overread in PREP " Masashi Honma
2026-05-21 22:58 ` [PATCH v8 6/6] wifi: mac80211: Fix PERR " Masashi Honma
2026-05-28 8:12 ` Johannes Berg
2026-05-29 23:07 ` Masashi Honma
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=8ab957b3c31dec7be844ea9e1ac2fbb2fdcd8278.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=masashi.honma@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox