qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] hw/block/nvme: fix resource leak in nvme_dif_rw


From: Gollu Appalanaidu
Subject: Re: [PATCH v2 1/2] hw/block/nvme: fix resource leak in nvme_dif_rw
Date: Mon, 29 Mar 2021 16:47:07 +0530
User-agent: Mutt/1.9.4 (2018-02-28)

On Mon, Mar 22, 2021 at 01:09:43PM +0100, Klaus Jensen wrote:
From: Klaus Jensen <k.jensen@samsung.com>

If nvme_map_dptr() fails, nvme_dif_rw() will leak the bounce context.
Fix this by using the same error handling as everywhere else in the
function.

Reported-by: Coverity (CID 1451080)
Fixes: 146f720c5563 ("hw/block/nvme: end-to-end data protection")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/block/nvme-dif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/nvme-dif.c b/hw/block/nvme-dif.c
index 2038d724bda5..e6f04faafb5f 100644
--- a/hw/block/nvme-dif.c
+++ b/hw/block/nvme-dif.c
@@ -432,7 +432,7 @@ uint16_t nvme_dif_rw(NvmeCtrl *n, NvmeRequest *req)

    status = nvme_map_dptr(n, &req->sg, mapped_len, &req->cmd);
    if (status) {
-        return status;
+        goto err;
Looks good to me.
    }

    ctx->data.bounce = g_malloc(len);
--
Reviewed-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
2.31.0







reply via email to

[Prev in Thread] Current Thread [Next in Thread]