From da998d0d6eb8ca6fbe7848cf4c0808797ab9c882 Mon Sep 17 00:00:00 2001 From: Kamal Heib Date: Wed, 23 Dec 2020 18:49:52 +0200 Subject: [PATCH] libqedr: Fix reported error code from create_cq [ Upstream commit e8b5a1d673f1eb2d93fb9fe09759fa03a6cf8aad ] Report EINVAL when trying to call qelr_create_cq() with number of CQEs bigger than the supported max_cqes, also fix the printed range. Fixes: c0965e4fe6fe ("libqedr (qelr) verbs") Signed-off-by: Kamal Heib Signed-off-by: Nicolas Morey-Chaisemartin --- providers/qedr/qelr_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/providers/qedr/qelr_verbs.c b/providers/qedr/qelr_verbs.c index e75d508f100b..631c9f844a95 100644 --- a/providers/qedr/qelr_verbs.c +++ b/providers/qedr/qelr_verbs.c @@ -231,7 +231,8 @@ struct ibv_cq *qelr_create_cq(struct ibv_context *context, int cqe, if (!cqe || cqe > cxt->max_cqes) { DP_ERR(cxt->dbg_fp, "create cq: failed. attempted to allocate %d cqes but valid range is 1...%d\n", - cqe, cqe > cxt->max_cqes); + cqe, cxt->max_cqes); + errno = EINVAL; return NULL; } -- 2.25.4