From: Jakub Kicinski <kuba@kernel.org>
To: David Yang <mmyangfl@gmail.com>
Cc: netdev@vger.kernel.org, Vladimir Oltean <vladimir.oltean@nxp.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Russell King <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/3] net: dsa: sync dsa_mall_policer_tc_entry with FLOW_ACTION_POLICE
Date: Thu, 29 Jan 2026 15:22:01 -0800 [thread overview]
Message-ID: <20260129152201.389fac74@kernel.org> (raw)
In-Reply-To: <20260126061340.757543-2-mmyangfl@gmail.com>
On Mon, 26 Jan 2026 14:13:29 +0800 David Yang wrote:
> - policer->rate_bytes_per_sec = act->police.rate_bytes_ps;
> - policer->burst = act->police.burst;
> + /* so sad, flow_offload.h did not export the type of act->police, and
> + * it's a nightmare to copy it field by field
> + */
> + static_assert(sizeof(act->police) == sizeof(*policer));
> + memcpy(policer, &act->police, sizeof(*policer));
This is of course an unacceptable hack. Nobody will realize that
there's a layout dependency here, not to mention struct randomization.
If someone adds fields presumably they will have to update
dsa_mall_policer_tc_entry_type() anyway, so we aren't saving much with this hack
next prev parent reply other threads:[~2026-01-29 23:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 6:13 [PATCH net-next 0/3] net: dsa: sync dsa_mall_policer_tc_entry with FLOW_ACTION_POLICE David Yang
2026-01-26 6:13 ` [PATCH net-next 1/3] " David Yang
2026-01-29 23:22 ` Jakub Kicinski [this message]
2026-01-26 6:13 ` [PATCH net-next 2/3] net: dsa: add dsa_mall_policer_tc_entry_type() helper David Yang
2026-01-26 6:13 ` [PATCH net-next 3/3] net: dsa: ocelot: check policer entry David Yang
2026-01-29 11:20 ` Paolo Abeni
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=20260129152201.389fac74@kernel.org \
--to=kuba@kernel.org \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.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.