diff options
author | Daniel Wagner <dwagner@suse.de> | 2023-12-18 16:30:51 +0100 |
---|---|---|
committer | Keith Busch <kbusch@kernel.org> | 2024-01-03 08:09:41 -0800 |
commit | 0e716cec6fb11a14c220ee17c404b67962e902f7 (patch) | |
tree | fa7063d6d6fc5930e441a16726ca0cc3d7ae6397 /drivers/nvme/target/trace.c | |
parent | 72e8c9379dbef2662c2479c3d142e4c44d598a5b (diff) | |
download | linux-0e716cec6fb11a14c220ee17c404b67962e902f7.tar.gz linux-0e716cec6fb11a14c220ee17c404b67962e902f7.tar.bz2 linux-0e716cec6fb11a14c220ee17c404b67962e902f7.zip |
nvmet-trace: avoid dereferencing pointer too early
The first command issued from the host to the target is the fabrics
connect command. At this point, neither the target queue nor the
controller have been allocated. But we already try to trace this command
in nvmet_req_init.
Reported by KASAN.
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers/nvme/target/trace.c')
-rw-r--r-- | drivers/nvme/target/trace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/nvme/target/trace.c b/drivers/nvme/target/trace.c index bff454d46255..6ee1f3db81d0 100644 --- a/drivers/nvme/target/trace.c +++ b/drivers/nvme/target/trace.c @@ -211,7 +211,7 @@ const char *nvmet_trace_disk_name(struct trace_seq *p, char *name) return ret; } -const char *nvmet_trace_ctrl_name(struct trace_seq *p, struct nvmet_ctrl *ctrl) +const char *nvmet_trace_ctrl_id(struct trace_seq *p, u16 ctrl_id) { const char *ret = trace_seq_buffer_ptr(p); @@ -224,8 +224,8 @@ const char *nvmet_trace_ctrl_name(struct trace_seq *p, struct nvmet_ctrl *ctrl) * If we can know the extra data of the connect command in this stage, * we can update this print statement later. */ - if (ctrl) - trace_seq_printf(p, "%d", ctrl->cntlid); + if (ctrl_id) + trace_seq_printf(p, "%d", ctrl_id); else trace_seq_printf(p, "_"); trace_seq_putc(p, 0); |