From: sashiko-bot@kernel.org
To: "Shaikh Kamaluddin" <shaikhkamal2012@gmail.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] cxl/mbox: Add Get Poison List snapshot support
Date: Sat, 10 Oct 2026 16:38:14 +0000 [thread overview]
Message-ID: <sashiko-outbox-166745@kernel.org> (raw)
In-Reply-To: <20261010162017.62506-2-shaikhkamal2012@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] cxl: cxl_poison_snapshot_append returns -ENOSPC, bypassing truncation handler
--
commit 14df359a915714a1d8f08f27fcdf1ccf13b88763
Author: Shaikh Kamaluddin <shaikhkamal2012@gmail.com>
cxl/mbox: Add Get Poison List snapshot support
The commit adds snapshot support to copy Get Poison List records from a
device into a caller-owned buffer. It allows callers to inspect the complete
set of collected records while preserving existing trace-only behavior for
current callers.
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index 55828a836c01a..2752b46ffee29 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
[ ... ]
> +static int cxl_poison_snapshot_append(struct cxl_poison_snapshot *snapshot,
> + struct cxl_poison_record *records,
> + u32 count)
> +{
[ ... ]
> + available = snapshot->capacity - snapshot->nr_records;
> + if (count > available) {
> + snapshot->truncated = true;
> + return -ENOSPC;
> + }
[Severity: High]
Does returning -ENOSPC here cause the caller to prematurely abort?
In drivers/cxl/core/mbox.c, cxl_poison_snapshot_append(), when the device
returns more poison records than snapshot->capacity, returning -ENOSPC instead
of clamping the count and returning success prevents the loop in
cxl_mem_get_poison_common() from completing its normal termination logic.
> +
> + memcpy(&snapshot->records[snapshot->nr_records], records,
> + count * sizeof(*records));
> + snapshot->nr_records += count;
> +
> + return 0;
> +}
> +
> +static int cxl_mem_get_poison_common(struct cxl_memdev *cxlmd, u64 offset,
> + u64 len, struct cxl_region *cxlr,
> + struct cxl_poison_snapshot *snapshot)
> {
[ ... ]
> + rc = cxl_poison_snapshot_append(snapshot, po->record, count);
> + if (rc)
> + break;
[Severity: High]
Does breaking early on -ENOSPC deprive the caller of the expected truncation
state?
In drivers/cxl/core/mbox.c, cxl_mem_get_poison_common(), if
cxl_poison_snapshot_append() returns -ENOSPC, this propagates up and breaks the
loop before the internal termination logic can be reached. The generic error
cascades up to the caller, bypassing the expected truncation handler designed
to handle this exact scenario.
> +
> + /* Protect against an uncleared _FLAG_MORE */
> - nr_records = nr_records + le16_to_cpu(po->count);
> + nr_records += count;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261010162017.62506-1-shaikhkamal2012@gmail.com?part=1
next prev parent reply other threads:[~2026-10-10 16:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 16:20 [RFC PATCH 0/5] cxl, mm: Keep device-reported poison out of the page allocator Shaikh Kamaluddin
2026-10-10 16:20 ` [RFC PATCH 1/5] cxl/mbox: Add Get Poison List snapshot support Shaikh Kamaluddin
2026-10-10 16:38 ` sashiko-bot [this message]
2026-10-10 16:20 ` [RFC PATCH 2/5] cxl/region: Factor decoder poison-list retrieval Shaikh Kamaluddin
2026-10-10 16:34 ` sashiko-bot
2026-10-10 16:20 ` [RFC PATCH 3/5] mm/memory-failure: Add a pre-online poison registry Shaikh Kamaluddin
2026-10-10 16:20 ` [RFC PATCH 4/5] mm/page_alloc: Keep pre-online poison out of the buddy allocator Shaikh Kamaluddin
2026-10-10 16:20 ` [RFC PATCH 5/5] cxl/region: Register device poison before exposing RAM Shaikh Kamaluddin
2026-10-10 16:33 ` sashiko-bot
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=sashiko-outbox-166745@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shaikhkamal2012@gmail.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