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:
parent
59255887e6
commit
1bad4957c8
|
@ -232,7 +232,7 @@ static int create_mr(PVRDMADev *dev, union pvrdma_cmd_req *req,
|
||||||
cmd->start, cmd->length, host_virt,
|
cmd->start, cmd->length, host_virt,
|
||||||
cmd->access_flags, &resp->mr_handle,
|
cmd->access_flags, &resp->mr_handle,
|
||||||
&resp->lkey, &resp->rkey);
|
&resp->lkey, &resp->rkey);
|
||||||
if (!resp->hdr.err) {
|
if (host_virt && !resp->hdr.err) {
|
||||||
munmap(host_virt, cmd->length);
|
munmap(host_virt, cmd->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue