]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/rdma: Fix possible munmap call on a NULL pointer
authorMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
Mon, 30 Apr 2018 20:02:17 +0000 (23:02 +0300)
committerMarcel Apfelbaum <marcel.apfelbaum@gmail.com>
Thu, 3 May 2018 17:52:29 +0000 (20:52 +0300)
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>

hw/rdma/vmw/pvrdma_cmd.c

index 99019d87419a60e88cda0ca51ffacca14073e266..f9dd78cb270a54336c08e42a897516e4438ace6b 100644 (file)
@@ -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);
     }