From: Daniel Golle <daniel@makrotopia.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Frank Wunderlich <frankwu@gmx.de>, Chad Monroe <chad@monroe.io>,
Cezary Wilmanski <cezary.wilmanski@adtran.com>,
Liang Xu <lxu@maxlinear.com>,
"Benny (Ying-Tsan) Weng" <yweng@maxlinear.com>,
Jose Maria Verdu Munoz <jverdu@maxlinear.com>,
Avinash Jayaraman <ajayaraman@maxlinear.com>,
John Crispin <john@phrozen.org>
Subject: Re: [PATCH net-next v5 2/2] net: dsa: mxl862xx: implement bridge offloading
Date: Thu, 19 Mar 2026 11:56:00 +0000 [thread overview]
Message-ID: <abvkUHCRI0yJdlgK@makrotopia.org> (raw)
In-Reply-To: <16a4ac6c-abde-4121-9032-7626640facbe@redhat.com>
On Thu, Mar 19, 2026 at 09:51:40AM +0100, Paolo Abeni wrote:
> On 3/15/26 5:20 PM, Daniel Golle wrote:
> > +static int mxl862xx_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
> > +{
> > + struct mxl862xx_cfg param;
> > + int ret;
> > +
> > + ret = MXL862XX_API_READ(ds->priv, MXL862XX_COMMON_CFGGET, param);
>
> AI review says:
>
> Is the param struct initialized here? Looking at MXL862XX_API_READ(), it
> expands to mxl862xx_api_wrap() which writes the contents of the data buffer
> to firmware MDIO registers before sending the GET command. This would send
> uninitialized kernel stack data to the firmware hardware.
>
> Every other MXL862XX_API_READ() call site in the driver uses a
> zero-initialized struct. For example, in mxl862xx_setup():
>
> struct mxl862xx_cfg cfg = {};
> ...
> ret = MXL862XX_API_READ(priv, MXL862XX_COMMON_CFGGET, cfg);
>
> Should param be initialized with = {} here?
>
While I agree that just sending over uninitialized memory is kinda ugly,
for this specific firmware API call it is not a problem because it
completely discards what ever is sent, and fully overwrites all
struct members before sending it back to the host.
Anyway zero-initializing it with {} is probably still good practise
and I'll do that, so AI or static analysis tools don't complain about
that.
next prev parent reply other threads:[~2026-03-19 11:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-15 16:20 [PATCH net-next v5 0/2] net: dsa: mxl862xx: add support for bridge offloading Daniel Golle
2026-03-15 16:20 ` [PATCH net-next v5 1/2] dsa: tag_mxl862xx: set dsa_default_offload_fwd_mark() Daniel Golle
2026-03-15 16:20 ` [PATCH net-next v5 2/2] net: dsa: mxl862xx: implement bridge offloading Daniel Golle
2026-03-19 8:51 ` Paolo Abeni
2026-03-19 11:56 ` Daniel Golle [this message]
2026-03-19 8:57 ` Paolo Abeni
2026-03-19 12:15 ` Daniel Golle
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=abvkUHCRI0yJdlgK@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=ajayaraman@maxlinear.com \
--cc=andrew@lunn.ch \
--cc=cezary.wilmanski@adtran.com \
--cc=chad@monroe.io \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frankwu@gmx.de \
--cc=horms@kernel.org \
--cc=john@phrozen.org \
--cc=jverdu@maxlinear.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lxu@maxlinear.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=yweng@maxlinear.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.