On 27/04/2018 17:58, Peter Maydell wrote:
> On 19 February 2018 at 11:43, Marcel Apfelbaum <mar...@redhat.com> wrote:
>> From: Yuval Shaia <yuval.sh...@oracle.com>
>>
>> First PVRDMA sub-module - implementation of the PVRDMA device.
>> - PVRDMA commands such as create CQ and create MR.
>> - Data path QP operations - post_send and post_recv.
>> - Completion handler.
> 
>> +void pvrdma_cq_poll(RdmaDeviceResources *dev_res, uint32_t cq_handle)
>> +{
>> +    RdmaRmCQ *cq;
>> +
>> +    cq = rdma_rm_get_cq(dev_res, cq_handle);
>> +    if (!cq) {
>> +        pr_dbg("Invalid CQ# %d\n", cq_handle);
>> +    }
>> +
>> +    rdma_backend_poll_cq(dev_res, &cq->backend_cq);
>> +}
> 
> Coverity CID 1390586: we check for cq being NULL, but then
> go ahead and use it anyway. If a NULL cq is a possible
> situation we should handle it correctly (early return?
> return an error value that the caller has to handle?
> something else?); if it is not possible then we should
> use assert rather than an if().

The cq_handle is provided by the guest, the code assumes
a sane guest, which is not safe.

I will change the code to return early.

Thanks,
Marcel

> 
> thanks
> -- PMM
> 


Reply via email to