git: 86b9d629c68f - main - nvme: Fix the data length in the Reservation Report command builder
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 09 Nov 2026 19:14:09 UTC
The branch main has been updated by ken:
URL: https://cgit.FreeBSD.org/src/commit/?id=86b9d629c68f6dc63543b9c0a6da6c96c857f3bc
commit 86b9d629c68f6dc63543b9c0a6da6c96c857f3bc
Author: Kenneth D. Merry <ken@FreeBSD.org>
AuthorDate: 2026-11-09 18:46:58 +0000
Commit: Kenneth D. Merry <ken@FreeBSD.org>
CommitDate: 2026-11-09 18:59:13 +0000
nvme: Fix the data length in the Reservation Report command builder
nvme_ns_resv_report_cmd() put its length argument, which callers
supply in bytes, directly into cdw10. The NUMD field is a 0's
based count of dwords, so the command asked the controller to
transfer nearly four times the size of the supplied data buffer.
In practice controllers limit the transfer to the length described
by the PRP entries, which is why this worked in testing, but the
command was incorrect.
Convert the byte count to a 0's based dword count in the builder.
Reported by: llm-postcr
Fixes: 7a9e4375316b
MFC after: 1 week
Sponsored by: Spectra Logic
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
---
sys/dev/nvme/nvme.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index 34929ee58f5e..ee39a101f48c 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -2274,7 +2274,8 @@ void nvme_ns_resv_report_cmd(struct nvme_command *cmd, uint32_t nsid,
{
cmd->opc = NVME_OPC_RESERVATION_REPORT;
cmd->nsid = htole32(nsid);
- cmd->cdw10 = htole32(length);
+ /* NUMD is a 0's based count of dwords; length is in bytes. */
+ cmd->cdw10 = htole32(length / 4 - 1);
cmd->cdw11 = htole32(report_type);
}