forked from luck/tmp_suning_uos_patched
nvmet-rdma: check for timeout in nvme_rdma_wait_for_cm()
Check whether queue->cm_error holds a value before reading it. This patch addresses Coverity ID 1373774: unchecked return value. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
43a6f8fb61
commit
35da77d556
|
@ -233,8 +233,15 @@ static void nvme_rdma_qp_event(struct ib_event *event, void *context)
|
|||
|
||||
static int nvme_rdma_wait_for_cm(struct nvme_rdma_queue *queue)
|
||||
{
|
||||
wait_for_completion_interruptible_timeout(&queue->cm_done,
|
||||
int ret;
|
||||
|
||||
ret = wait_for_completion_interruptible_timeout(&queue->cm_done,
|
||||
msecs_to_jiffies(NVME_RDMA_CONNECT_TIMEOUT_MS) + 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (ret == 0)
|
||||
return -ETIMEDOUT;
|
||||
WARN_ON_ONCE(queue->cm_error > 0);
|
||||
return queue->cm_error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user