From: sashiko-bot@kernel.org
To: kangfenglong <kangfenglong@huawei.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v3] nvme-pci: fix CMB mapping when CMBSZ Size field is zero
Date: Mon, 22 Jun 2026 02:47:13 +0000 [thread overview]
Message-ID: <20260622024713.CBA9A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260622024129.40800-1-kangfenglong@huawei.com>
> The controller memory buffer size is defined by the SZ field in the
> CMBSZ register (bits 31:12). According to the NVMe specification, a
> value of zero in the SZ field indicates that no CMB is present.
>
> Commit f65efd6dfe4e ("nvme-pci: clean up CMB initialization") replaced
> the check for a zero SZ field with a check for a zero CMBSZ register
> value, under the assumption that a zero register implies no CMB.
> However, a CMBSZ register can be non-zero while the SZ field is zero,
> for example when Size Units (SZU) is set to a non-zero value but the
> actual size is zero (e.g. CMBSZ = 0x100: SZU = 1, SZ = 0).
>
> When this happens, nvme_map_cmb() proceeds to compute a size of zero,
> passes the alignment checks (zero is always aligned), and calls
> pci_p2pdma_add_resource() with size=0. The P2PDMA subsystem then
> defaults size to the entire remaining BAR, which may not be properly
> [ ... ]
> to detect integer overflow that could wrap to a non-zero value and
> bypass the SZ check.
>
> Fixes: f65efd6dfe4e ("nvme-pci: clean up CMB initialization")
> Signed-off-by: kangfenglong <kangfenglong@huawei.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260622024129.40800-1-kangfenglong@huawei.com?part=1
next prev parent reply other threads:[~2026-06-22 2:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20260622031353epcas5p20f6585c6c8c9b2753e6884d99fe6670a@epcas5p2.samsung.com>
2026-06-22 2:41 ` [PATCH v3] nvme-pci: fix CMB mapping when CMBSZ Size field is zero kangfenglong
2026-06-22 2:47 ` sashiko-bot [this message]
2026-09-02 7:45 ` Kangfenglong
2026-09-03 3:53 ` Kanchan Joshi
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=20260622024713.CBA9A1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kangfenglong@huawei.com \
--cc=linux-pci@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.