]> err.no Git - linux-2.6/commitdiff
IB/mlx4: Fix handling of wq->tail for send completions
authorRoland Dreier <rolandd@cisco.com>
Tue, 12 Jun 2007 17:50:42 +0000 (10:50 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 12 Jun 2007 17:50:42 +0000 (10:50 -0700)
Cast the increment added to wq->tail when send completions are
processed to u16 to avoid using wrong values caused by standard
integer promotions.

The same bug was fixed in libmlx4 by Eli Cohen <eli@mellanox.co.il>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mlx4/cq.c

index b2a290c6703a4b59634daf93763b43ab4cbc5a86..048c5274ab1c600a51d46b05b8b5a42a63d9c60d 100644 (file)
@@ -354,7 +354,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
        if (is_send) {
                wq = &(*cur_qp)->sq;
                wqe_ctr = be16_to_cpu(cqe->wqe_index);
-               wq->tail += wqe_ctr - (u16) wq->tail;
+               wq->tail += (u16) (wqe_ctr - (u16) wq->tail);
                wc->wr_id = wq->wrid[wq->tail & (wq->max - 1)];
                ++wq->tail;
        } else if ((*cur_qp)->ibqp.srq) {