From: Yuval Shaia Date: Thu, 25 Oct 2018 06:17:00 +0000 (+0300) Subject: hw/pvrdma: Check the correct return value X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=dee2e53c86de37dea4f36936eab5a6aef340b8f8;p=qemu.git hw/pvrdma: Check the correct return value Return value of 0 means ok, we want to free the memory only in case of error. Signed-off-by: Yuval Shaia Message-Id: <20181025061700.17050-1-yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum Signed-off-by: Marcel Apfelbaum --- diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c index 4faeb21631..57d6f41ae6 100644 --- a/hw/rdma/vmw/pvrdma_cmd.c +++ b/hw/rdma/vmw/pvrdma_cmd.c @@ -232,7 +232,7 @@ static int create_mr(PVRDMADev *dev, union pvrdma_cmd_req *req, cmd->start, cmd->length, host_virt, cmd->access_flags, &resp->mr_handle, &resp->lkey, &resp->rkey); - if (host_virt && !resp->hdr.err) { + if (resp->hdr.err && host_virt) { munmap(host_virt, cmd->length); }