Repository navigation
engines/nvme: fix addr/data_len for no data nvme commands - #2101
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates fio_nvme_uring_cmd_prep() buffer handling to only attach user buffers to true data-transfer NVMe opcodes, and rejects unsupported commands early.
Changes:
- Restricts
cmd->addr/cmd->data_lenpopulation to read/write/compare. - Returns
-ENOTSUPfor opcodes not explicitly supported by this path. - Treats write-zeroes/write-uncorrectable/verify as “allowed but non-data” commands.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+393
to
+402
| /* use buffer only for data transfer commands */ | ||
| if (cmd->opcode == nvme_cmd_read || | ||
| cmd->opcode == nvme_cmd_write || | ||
| cmd->opcode == nvme_cmd_compare) { | ||
| cmd->addr = (__u64)(uintptr_t)io_u->xfer_buf; | ||
| else | ||
| cmd->addr = (__u64)(uintptr_t)NULL; | ||
| cmd->data_len = io_u->xfer_buflen; | ||
| cmd->data_len = io_u->xfer_buflen; | ||
| } else if (cmd->opcode != nvme_cmd_write_zeroes && | ||
| cmd->opcode != nvme_cmd_write_uncor && | ||
| cmd->opcode != nvme_cmd_verify) | ||
| return -ENOTSUP; |
Comment on lines
+394
to
+402
| if (cmd->opcode == nvme_cmd_read || | ||
| cmd->opcode == nvme_cmd_write || | ||
| cmd->opcode == nvme_cmd_compare) { | ||
| cmd->addr = (__u64)(uintptr_t)io_u->xfer_buf; | ||
| else | ||
| cmd->addr = (__u64)(uintptr_t)NULL; | ||
| cmd->data_len = io_u->xfer_buflen; | ||
| cmd->data_len = io_u->xfer_buflen; | ||
| } else if (cmd->opcode != nvme_cmd_write_zeroes && | ||
| cmd->opcode != nvme_cmd_write_uncor && | ||
| cmd->opcode != nvme_cmd_verify) | ||
| return -ENOTSUP; |
Collaborator
|
Please use a |
assign 'cmd->data_len' to xfer_buflen and 'cmd->addr' to xfer_buf for data transfer commands - read, write and compare opcode. Previously, write zeroes had 'cmd->data_len' assigned to xfer_buflen while the address was set to NULL causing bad address error. Any unrecognised opcode returns -ENOTSUP. This ensures no data transfer opcode - write zeroes, uncor and verify have addr and data_len set to 0. Signed-off-by: Swarna Prabhu <s.prabhu@samsung.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
assign 'cmd->data_len' to xfer_buflen and 'cmd->addr' to xfer_buf for data transfer commands - read, write and compare opcode. Previously, write zeroes had 'cmd->data_len' assigned to xfer_buflen while the address was set to NULL causing bad address error. Any unrecognised opcode returns -ENOTSUP. This ensures no data transfer opcode - write zeroes, uncor and verify have addr and data_len set to 0.
Fixes: #2089 (review)