* [PATCH] nvmet: free smart-log buffer after use
@ 2018-06-11 7:20 Chaitanya Kulkarni
2018-06-11 14:16 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Chaitanya Kulkarni @ 2018-06-11 7:20 UTC (permalink / raw)
Free smart-log buffer allocated in the function after use.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
drivers/nvme/target/admin-cmd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 962532842769..ce43c3aaf715 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -118,10 +118,10 @@ static void nvmet_execute_get_log_page_smart(struct nvmet_req *req)
status = nvmet_get_smart_log_all(req, log);
else
status = nvmet_get_smart_log_nsid(req, log);
- if (status)
- goto out;
+ if (status == NVME_SC_SUCCESS)
+ status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
- status = nvmet_copy_to_sgl(req, 0, log, sizeof(*log));
+ kfree(log);
out:
nvmet_req_complete(req, status);
}
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] nvmet: free smart-log buffer after use
2018-06-11 7:20 [PATCH] nvmet: free smart-log buffer after use Chaitanya Kulkarni
@ 2018-06-11 14:16 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2018-06-11 14:16 UTC (permalink / raw)
On Mon, Jun 11, 2018@03:20:24AM -0400, Chaitanya Kulkarni wrote:
> Free smart-log buffer allocated in the function after use.
>
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
Thanks, applied with a small tweak.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-11 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-11 7:20 [PATCH] nvmet: free smart-log buffer after use Chaitanya Kulkarni
2018-06-11 14:16 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.