From: sashiko-bot@kernel.org
To: "Alison Schofield" <alison.schofield@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v5 1/4] cxl/hdm: Reject switch decoder interleave ways that overflow targets
Date: Sat, 08 Aug 2026 00:17:32 +0000 [thread overview]
Message-ID: <20260808001733.52ACD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <af094094813d7f51d86cbf608936270b7d85526e.1786143520.git.alison.schofield@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Incorrect parsing of the target list register on Big-Endian architectures.
--
--- Patch [1]: [PATCH v5 1/4] cxl/hdm: Reject switch decoder interleave ways that overflow targets ---
commit f23bc6bdfaf477309897aefc0c8b1cee5f060c37
Author: Alison Schofield <alison.schofield@intel.com>
cxl/hdm: Reject switch decoder interleave ways that overflow targets
Switch decoder enumeration validates that the interleave ways encoding
is legal, but not that the resulting number of ways fits the available
targets. This can overrun the target array (target_list.target_id[])
during enumeration of 12 or 16 way interleaves.
Link: https://sashiko.dev/#/patchset/20260711180755.1779002-1-alison.schofield@intel.com?part=1
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 0c80b76a5f9b4..c394b3d54d362 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
[ ... ]
> @@ -1084,6 +1086,16 @@ static int init_hdm_decoder(struct cxl_port *port, struct cxl_decoder *cxld,
> cxld->interleave_ways, cxld->interleave_granularity);
>
> if (!cxled) {
> + struct cxl_switch_decoder *cxlsd = to_cxl_switch_decoder(&cxld->dev);
> +
> + if (cxld->interleave_ways > cxlsd->nr_targets) {
> + dev_err(&port->dev,
> + "decoder%d.%d: interleave ways: %d exceeds targets: %d\n",
> + port->id, cxld->id, cxld->interleave_ways,
> + cxlsd->nr_targets);
> + return -ENXIO;
> + }
> +
> lo = readl(hdm + CXL_HDM_DECODER0_TL_LOW(which));
> hi = readl(hdm + CXL_HDM_DECODER0_TL_HIGH(which));
> target_list.value = (hi << 32) + lo;
[Severity: High]
This isn't a bug introduced by this patch, but does this logic in
init_hdm_decoder() parse the target list register incorrectly on Big-Endian
architectures?
Because hi and lo are in CPU endianness, on a Big-Endian system the shift
operation places the most significant bytes of hi at the lowest addresses of
the target_list.target_id array, effectively reversing the hardware target
IDs.
When the 64-bit target list is read out sequentially as an array of bytes,
could this result in physical memory addresses being routed to the wrong
target ports on Big-Endian systems?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1786143520.git.alison.schofield@intel.com?part=1
next prev parent reply other threads:[~2026-08-08 0:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 0:05 [PATCH v5 0/4] Harden HDM decoder enumeration Alison Schofield
2026-08-08 0:05 ` [PATCH v5 1/4] cxl/hdm: Reject switch decoder interleave ways that overflow targets Alison Schofield
2026-08-08 0:17 ` sashiko-bot [this message]
2026-08-08 0:36 ` Alison Schofield
2026-08-08 5:50 ` Li Ming
2026-08-08 0:05 ` [PATCH v5 2/4] cxl/hdm: Make switch decoder target parsing endian-safe Alison Schofield
2026-08-08 5:51 ` Li Ming
2026-08-08 0:05 ` [PATCH v5 3/4] cxl/hdm: Restore commit_end when decoder enumeration fails Alison Schofield
2026-08-08 0:05 ` [PATCH v5 4/4] cxl/port: Bound switch decoder target array access by nr_targets Alison Schofield
2026-08-08 5:52 ` Li Ming
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=20260808001733.52ACD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alison.schofield@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.