aboutsummaryrefslogtreecommitdiff
path: root/hw/rdma
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2018-04-30 23:02:17 +0300
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>2018-05-03 20:52:29 +0300
commit1bad4957c8c4d5367961cb3d5287b2f25a1d6847 (patch)
treeb8049ffc6df95eb54be2fa6f51387f0d0ba344b3 /hw/rdma
parent59255887e6cafeff747250d2613003a41d1d9dff (diff)
downloadqemu-1bad4957c8c4d5367961cb3d5287b2f25a1d6847.zip
qemu-1bad4957c8c4d5367961cb3d5287b2f25a1d6847.tar.gz
qemu-1bad4957c8c4d5367961cb3d5287b2f25a1d6847.tar.bz2
hw/rdma: Fix possible munmap call on a NULL pointer
Coverity CID 1390620: we call munmap() on a NULL pointer. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com> Message-Id: <20180430200223.4119-2-marcel.apfelbaum@gmail.com>
Diffstat (limited to 'hw/rdma')
-rw-r--r--hw/rdma/vmw/pvrdma_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
index 99019d8..f9dd78c 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 (!resp->hdr.err) {
+ if (host_virt && !resp->hdr.err) {
munmap(host_virt, cmd->length);
}