From: "Shengzhuo Wei" <me@cherr.cc>
To: "Christian Lamparter" <chunkeey@gmail.com>
Cc: "Shengzhuo Wei" <me@cherr.cc>,
"David S. Miller" <davem@davemloft.net>,
"John W. Linville" <linville@tuxdriver.com>,
<linux-wireless@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] wifi: p54: validate curve data length in the calibration curve converters
Date: Sun, 6 Sep 2026 19:43:14 +0800 [thread overview]
Message-ID: <ap1R0jU3UMVGI3ml@pve> (raw)
In-Reply-To: <f3eb0dfe-3b9c-483b-b802-2207fe8b747b@gmail.com>
On 2026-09-06 11:31, Christian Lamparter wrote:
> > diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c
> > index 95580921d933..0dc848d77c5e 100644
> > --- a/drivers/net/wireless/intersil/p54/eeprom.c
> > +++ b/drivers/net/wireless/intersil/p54/eeprom.c
> > @@ -414,17 +414,22 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
> > }
> > static int p54_convert_rev0(struct ieee80211_hw *dev,
> > - struct pda_pa_curve_data *curve_data)
> > + struct pda_pa_curve_data *curve_data, size_t len)
> > {
> > struct p54_common *priv = dev->priv;
> > struct p54_pa_curve_data_sample *dst;
> > struct pda_pa_curve_data_sample_rev0 *src;
> > + size_t needed = curve_data->channels *
> > + (sizeof(*src) * curve_data->points_per_channel + 2);
> > size_t cd_len = sizeof(*curve_data) +
> > (curve_data->points_per_channel*sizeof(*dst) + 2) *
> > curve_data->channels;
> > unsigned int i, j;
> > void *source, *target;
> > + if (len < sizeof(*curve_data) + needed)
> > + return -EINVAL;
> > +
>
> Hmm, Puh. Interessting. Several things. But yeah, this should work.
>
> Acked-by: Christian Lamparter <chunkeey@gmail.com>
Hi Christian,
Thanks for the review and the Ack.
> Still I have some questions: Did you write/touch any of this yourself?
> Or is this patch straight from the model?
AI found the bug. I wrote the fix myself and used AI to review it
afterwards.
> It's because I can grok (heh) why "needed" ended up as a separate variable next to cd_len.
> But why was the sizeof(*curve_data) not included there too? It's only used once in the
> if check so and this sounds like the "needed" needed some extra? Maybe because it was
> already checked?
I kept sizeof(*curve_data) separate because I was thinking of needed
as the input data size without the header. But since it is only used
in that check, adding the header there too would be simpler.
Would you like me to send a v3 that makes just this change in both
converters?
Thanks,
Shengzhuo
next prev parent reply other threads:[~2026-09-06 11:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260831-p54-pda-validation-v2-0-dae566b388c8@cherr.cc>
[not found] ` <20260831-p54-pda-validation-v2-1-dae566b388c8@cherr.cc>
2026-09-06 9:31 ` [PATCH v2 1/2] wifi: p54: validate curve data length in the calibration curve converters Christian Lamparter
2026-09-06 11:43 ` Shengzhuo Wei [this message]
2026-09-06 14:02 ` Christian Lamparter
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=ap1R0jU3UMVGI3ml@pve \
--to=me@cherr.cc \
--cc=chunkeey@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=stable@vger.kernel.org \
/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