hw/pvrdma: Check the correct return value
PATCH 1/1 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 <[email protected]>
--- hw/rdma/vmw/pvrdma_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/rdma/vmw/pvrdma_cmd.c +1 -1
@@ -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); }
Signature · 1 line
2.17.2
Quoted 13 lines · Yuval Shaia
Return value of 0 means ok, we want to free the memory only in case of error.
Signed-off-by Yuval Shaia <[email protected]>--- hw/rdma/vmw/pvrdma_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/rdma/vmw/pvrdma_cmd.c +0
-0
hw/rdma/vmw/pvrdma_cmd.c static int create_mr(PVRDMADev *dev, union pvrdma_cmd_req *req, · line 238
Quoted 8 lines
hw/rdma/vmw/pvrdma_cmd.c +1
-1@@ -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); }
Reviewed-by Marcel Apfelbaum<[email protected]>
Thanks,
Marcel