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>
This commit is contained in:
Marcel Apfelbaum 2018-04-30 23:02:17 +03:00
parent 59255887e6
commit 1bad4957c8

View 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);
}