IB/mlx4: Fix off-by-one errors in calls to mlx4_ib_free_cq_buf()
authorRoland Dreier <rolandd@cisco.com>
Thu, 1 May 2008 02:52:55 +0000 (19:52 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 1 May 2008 02:52:55 +0000 (19:52 -0700)
commit3ae15e1623b9d32eb410c2a23d90e47b16e6acd0
treeb1138d36523cc8f0f5b3fae12f81f573eae96997
parentc65a3500b2947d344862da8cce626b7cc7ec5758
IB/mlx4: Fix off-by-one errors in calls to mlx4_ib_free_cq_buf()

When I merged bbf8eed1 ("IB/mlx4: Add support for resizing CQs") I
changed things around so that mlx4_ib_alloc_cq_buf() and
mlx4_ib_free_cq_buf() were used everywhere they could be.  However, I
screwed up the number of entries passed into mlx4_ib_alloc_cq_buf()
in a couple places -- the function bumps the number of entries
internally, so the caller shouldn't add 1 as well.

Passing a too-big value for the number of entries to mlx4_ib_free_cq_buf()
can cause the cleanup to go off the end of an array and corrupt
allocator state in interesting ways.

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