From: Jonathan Cameron <jic23@kernel.org>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Gaobin Huang <huanggaobin23@semi.ac.cn>,
<linux-cxl@vger.kernel.org>, Davidlohr Bueso <dave@stgolabs.net>,
Dave Jiang <dave.jiang@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dan Williams <djbw@kernel.org>, Li Ming <ming.li@zohomail.com>,
Richard Cheng <icheng@nvidia.com>, <linux-kernel@vger.kernel.org>,
Anisa Su <anisa.su887@gmail.com>
Subject: Re: [PATCH v2] cxl/mbox: bound the Get Supported Logs entry count by the payload
Date: Fri, 18 Sep 2026 20:32:54 +0100 [thread overview]
Message-ID: <20260918203254.08c34055@jic23-hlaptop> (raw)
In-Reply-To: <aqx6rM90rFZEsTuB@aschofie-mobl2.lan>
> > rc = -ENOENT;
> > for (i = 0; i < le16_to_cpu(gsl->entries); i++) {
> > - u32 size = le32_to_cpu(gsl->entry[i].size);
> > - uuid_t uuid = gsl->entry[i].uuid;
> > + u32 size;
> > + uuid_t uuid;
> > u8 *log;
> >
> > + if (i >= max_entries) {
> > + dev_warn_ratelimited(dev,
> > + "GSL: device claimed %u entries but the payload holds %zu\n",
> > + le16_to_cpu(gsl->entries),
> > + max_entries);
> > + break;
> > + }
>
> Question as above. Why not reject the malformed response here?
> If there is a reason to salvage entries that fit, explain that in the
> commit log.
>
> If the intent is to validate the device supplied count against max_entries,
> it seems clearer to validate the count once before entering the loop.
Seconded. Error out as early as it is convenient to do validation.
Here that is as Alison says before the loop starts.
Thanks,
Jonathan
next prev parent reply other threads:[~2026-09-18 19:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 10:46 [PATCH v2] cxl/mbox: bound the Get Supported Logs entry count by the payload Gaobin Huang
2026-09-17 10:53 ` sashiko-bot
2026-09-17 23:41 ` Alison Schofield
2026-09-18 19:32 ` Jonathan Cameron [this message]
2026-09-29 6:14 ` 黄高彬
2026-09-21 7:29 ` Richard Cheng
2026-09-29 6:15 ` 黄高彬
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=20260918203254.08c34055@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=alison.schofield@intel.com \
--cc=anisa.su887@gmail.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=huanggaobin23@semi.ac.cn \
--cc=icheng@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=vishal.l.verma@intel.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