Re: [PATCH net-next 1/3] net: dsa: sync dsa_mall_policer_tc_entry with FLOW_ACTION_POLICE
From: Jakub Kicinski
Date: Thu Jan 29 2026 - 18:22:15 EST
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