diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-07-04 05:58:02 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-04 14:06:26 -0400 |
commit | c1dfc0114c901b4f46c85ceff0491debf2b2a2ec (patch) | |
tree | 427a3e3635c02e542e86e253593503c8843fd930 /drivers/infiniband | |
parent | 474e5a86067e5f12c97d1db8b170c7f45b53097a (diff) |
RDMA/bnxt_re: Fix a bunch of off by one bugs in qplib_fp.c
The srq->swq[] is allocated in bnxt_qplib_create_srq(). It has
srq->hwq.max_elements elements so these tests should be > instead of >=
or we might go beyond the end of the array.
Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/bnxt_re/qplib_fp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c index 50d8f1fc98d5..e426b990c1dd 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c | |||
@@ -2354,7 +2354,7 @@ static int bnxt_qplib_cq_process_res_rc(struct bnxt_qplib_cq *cq, | |||
2354 | srq = qp->srq; | 2354 | srq = qp->srq; |
2355 | if (!srq) | 2355 | if (!srq) |
2356 | return -EINVAL; | 2356 | return -EINVAL; |
2357 | if (wr_id_idx > srq->hwq.max_elements) { | 2357 | if (wr_id_idx >= srq->hwq.max_elements) { |
2358 | dev_err(&cq->hwq.pdev->dev, | 2358 | dev_err(&cq->hwq.pdev->dev, |
2359 | "QPLIB: FP: CQ Process RC "); | 2359 | "QPLIB: FP: CQ Process RC "); |
2360 | dev_err(&cq->hwq.pdev->dev, | 2360 | dev_err(&cq->hwq.pdev->dev, |
@@ -2369,7 +2369,7 @@ static int bnxt_qplib_cq_process_res_rc(struct bnxt_qplib_cq *cq, | |||
2369 | *pcqe = cqe; | 2369 | *pcqe = cqe; |
2370 | } else { | 2370 | } else { |
2371 | rq = &qp->rq; | 2371 | rq = &qp->rq; |
2372 | if (wr_id_idx > rq->hwq.max_elements) { | 2372 | if (wr_id_idx >= rq->hwq.max_elements) { |
2373 | dev_err(&cq->hwq.pdev->dev, | 2373 | dev_err(&cq->hwq.pdev->dev, |
2374 | "QPLIB: FP: CQ Process RC "); | 2374 | "QPLIB: FP: CQ Process RC "); |
2375 | dev_err(&cq->hwq.pdev->dev, | 2375 | dev_err(&cq->hwq.pdev->dev, |
@@ -2437,7 +2437,7 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq, | |||
2437 | if (!srq) | 2437 | if (!srq) |
2438 | return -EINVAL; | 2438 | return -EINVAL; |
2439 | 2439 | ||
2440 | if (wr_id_idx > srq->hwq.max_elements) { | 2440 | if (wr_id_idx >= srq->hwq.max_elements) { |
2441 | dev_err(&cq->hwq.pdev->dev, | 2441 | dev_err(&cq->hwq.pdev->dev, |
2442 | "QPLIB: FP: CQ Process UD "); | 2442 | "QPLIB: FP: CQ Process UD "); |
2443 | dev_err(&cq->hwq.pdev->dev, | 2443 | dev_err(&cq->hwq.pdev->dev, |
@@ -2452,7 +2452,7 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq, | |||
2452 | *pcqe = cqe; | 2452 | *pcqe = cqe; |
2453 | } else { | 2453 | } else { |
2454 | rq = &qp->rq; | 2454 | rq = &qp->rq; |
2455 | if (wr_id_idx > rq->hwq.max_elements) { | 2455 | if (wr_id_idx >= rq->hwq.max_elements) { |
2456 | dev_err(&cq->hwq.pdev->dev, | 2456 | dev_err(&cq->hwq.pdev->dev, |
2457 | "QPLIB: FP: CQ Process UD "); | 2457 | "QPLIB: FP: CQ Process UD "); |
2458 | dev_err(&cq->hwq.pdev->dev, | 2458 | dev_err(&cq->hwq.pdev->dev, |
@@ -2546,7 +2546,7 @@ static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, | |||
2546 | "QPLIB: FP: SRQ used but not defined??"); | 2546 | "QPLIB: FP: SRQ used but not defined??"); |
2547 | return -EINVAL; | 2547 | return -EINVAL; |
2548 | } | 2548 | } |
2549 | if (wr_id_idx > srq->hwq.max_elements) { | 2549 | if (wr_id_idx >= srq->hwq.max_elements) { |
2550 | dev_err(&cq->hwq.pdev->dev, | 2550 | dev_err(&cq->hwq.pdev->dev, |
2551 | "QPLIB: FP: CQ Process Raw/QP1 "); | 2551 | "QPLIB: FP: CQ Process Raw/QP1 "); |
2552 | dev_err(&cq->hwq.pdev->dev, | 2552 | dev_err(&cq->hwq.pdev->dev, |
@@ -2561,7 +2561,7 @@ static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, | |||
2561 | *pcqe = cqe; | 2561 | *pcqe = cqe; |
2562 | } else { | 2562 | } else { |
2563 | rq = &qp->rq; | 2563 | rq = &qp->rq; |
2564 | if (wr_id_idx > rq->hwq.max_elements) { | 2564 | if (wr_id_idx >= rq->hwq.max_elements) { |
2565 | dev_err(&cq->hwq.pdev->dev, | 2565 | dev_err(&cq->hwq.pdev->dev, |
2566 | "QPLIB: FP: CQ Process Raw/QP1 RQ wr_id "); | 2566 | "QPLIB: FP: CQ Process Raw/QP1 RQ wr_id "); |
2567 | dev_err(&cq->hwq.pdev->dev, | 2567 | dev_err(&cq->hwq.pdev->dev, |