Skip to content

Commit 5c629dc

Browse files
keithbuschChristoph Hellwig
authored andcommitted
nvme: use struct group for generic command dwords
This will allow the trace event to know the full size of the data intended to be copied and silence read overflow checks. Reported-by: John Garry <john.garry@huawei.com> Suggested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 73029c9 commit 5c629dc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

drivers/nvme/host/trace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ TRACE_EVENT(nvme_setup_cmd,
6969
__entry->metadata = !!blk_integrity_rq(req);
7070
__entry->fctype = cmd->fabrics.fctype;
7171
__assign_disk_name(__entry->disk, req->q->disk);
72-
memcpy(__entry->cdw10, &cmd->common.cdw10,
72+
memcpy(__entry->cdw10, &cmd->common.cdws,
7373
sizeof(__entry->cdw10));
7474
),
7575
TP_printk("nvme%d: %sqid=%d, cmdid=%u, nsid=%u, flags=0x%x, meta=0x%x, cmd=(%s %s)",

include/linux/nvme.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,12 +906,14 @@ struct nvme_common_command {
906906
__le32 cdw2[2];
907907
__le64 metadata;
908908
union nvme_data_ptr dptr;
909+
struct_group(cdws,
909910
__le32 cdw10;
910911
__le32 cdw11;
911912
__le32 cdw12;
912913
__le32 cdw13;
913914
__le32 cdw14;
914915
__le32 cdw15;
916+
);
915917
};
916918

917919
struct nvme_rw_command {

0 commit comments

Comments
 (0)