* [PATCH] nvme/target/admin-cmd.c: Fix a bug in 'nvmet_execute_get_log_page_error'
@ 2019-08-15 12:43 amit.engel
2019-08-15 17:22 ` Sagi Grimberg
0 siblings, 1 reply; 3+ messages in thread
From: amit.engel @ 2019-08-15 12:43 UTC (permalink / raw)
From: Amit <amit.engel@emc.com>
ensure that nvmet_copy_to_sgl does not exceed data_len
Signed-off-by: Amit <amit.engel at emc.com>
---
drivers/nvme/target/admin-cmd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 51800a9ce9a9..fd7749727f55 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -40,13 +40,14 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
u16 status = NVME_SC_SUCCESS;
unsigned long flags;
off_t offset = 0;
+ size_t num_of_sgl_slots = req->data_len/sizeof(struct nvme_error_slot);
u64 slot;
u64 i;
spin_lock_irqsave(&ctrl->error_lock, flags);
slot = ctrl->err_counter % NVMET_ERROR_LOG_SLOTS;
- for (i = 0; i < NVMET_ERROR_LOG_SLOTS; i++) {
+ for (i = 0; i < NVMET_ERROR_LOG_SLOTS && i < num_of_sgl_slots; i++) {
status = nvmet_copy_to_sgl(req, offset, &ctrl->slots[slot],
sizeof(struct nvme_error_slot));
if (status)
--
2.16.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] nvme/target/admin-cmd.c: Fix a bug in 'nvmet_execute_get_log_page_error'
2019-08-15 12:43 [PATCH] nvme/target/admin-cmd.c: Fix a bug in 'nvmet_execute_get_log_page_error' amit.engel
@ 2019-08-15 17:22 ` Sagi Grimberg
0 siblings, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2019-08-15 17:22 UTC (permalink / raw)
> From: Amit <amit.engel at emc.com>
>
> ensure that nvmet_copy_to_sgl does not exceed data_len
>
> Signed-off-by: Amit <amit.engel at emc.com>
> ---
> drivers/nvme/target/admin-cmd.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index 51800a9ce9a9..fd7749727f55 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -40,13 +40,14 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
> u16 status = NVME_SC_SUCCESS;
> unsigned long flags;
> off_t offset = 0;
> + size_t num_of_sgl_slots = req->data_len/sizeof(struct nvme_error_slot);
This should be do_div.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] nvme/target/admin-cmd.c: Fix a bug in 'nvmet_execute_get_log_page_error'
[not found] ` <442e4fd6-0288-8da4-fec4-3e5ae6df5dae@grimberg.me>
@ 2019-08-31 18:51 ` Engel, Amit
0 siblings, 0 replies; 3+ messages in thread
From: Engel, Amit @ 2019-08-31 18:51 UTC (permalink / raw)
To: Sagi Grimberg, Christoph Hellwig; +Cc: linux-nvme
Hi Sagi,
I updated the commit message per you ask.
Thanks!
Amit
-----Original Message-----
From: Sagi Grimberg <sagi@grimberg.me>
Sent: Thursday, August 29, 2019 9:50 PM
To: Engel, Amit; Christoph Hellwig
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme/target/admin-cmd.c: Fix a bug in 'nvmet_execute_get_log_page_error'
[EXTERNAL EMAIL]
> Hi, Any update regarding my below fix proposal?
The patch is fine, but can you please update the commit message,
First: the title should be:
nvmet: fix a wrong error status returned in error log page
And the message body needs to be:
When the command data_len cannot hold all the controller errors, we should simply return as much errors as we can fit instead of failing the command.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-31 18:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15 12:43 [PATCH] nvme/target/admin-cmd.c: Fix a bug in 'nvmet_execute_get_log_page_error' amit.engel
2019-08-15 17:22 ` Sagi Grimberg
[not found] <20190821063711.1252-1-amit.engel@dell.com>
[not found] ` <20190821234559.GB27887@infradead.org>
[not found] ` <8739B0CD2FC2DC40AF691A1CCBB9896034606D14@MX302CL04.corp.emc.com>
[not found] ` <8739B0CD2FC2DC40AF691A1CCBB9896034606E73@MX302CL04.corp.emc.com>
[not found] ` <8739B0CD2FC2DC40AF691A1CCBB989603460714F@MX302CL04.corp.emc.com>
[not found] ` <442e4fd6-0288-8da4-fec4-3e5ae6df5dae@grimberg.me>
2019-08-31 18:51 ` Engel, Amit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).