diff options
author | Dennis Dalessandro | 2017-05-30 02:19:21 +0200 |
---|---|---|
committer | Doug Ledford | 2017-06-27 22:58:12 +0200 |
commit | 6c31e5283cb06b81a13cc88da2f2ad3db594a935 (patch) | |
tree | 9f0c07b33111f9a1cbab1759a946e2a18426c9d2 /drivers/infiniband/sw | |
parent | IB/hfi1: Fix spelling mistake in linkdown reason (diff) | |
download | kernel-qcow2-linux-6c31e5283cb06b81a13cc88da2f2ad3db594a935.tar.gz kernel-qcow2-linux-6c31e5283cb06b81a13cc88da2f2ad3db594a935.tar.xz kernel-qcow2-linux-6c31e5283cb06b81a13cc88da2f2ad3db594a935.zip |
IB/hfi1: Use QPN mask to avoid overflow
Ensure we can't come up with an array size that is bigger than the array
by applying the QPN mask before the divide in the free_qpn function.
Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/sw')
-rw-r--r-- | drivers/infiniband/sw/rdmavt/qp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index a372afbbfbef..2ce0928dddd6 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c @@ -645,7 +645,7 @@ static void rvt_free_qpn(struct rvt_qpn_table *qpt, u32 qpn) { struct rvt_qpn_map *map; - map = qpt->map + qpn / RVT_BITS_PER_PAGE; + map = qpt->map + (qpn & RVT_QPN_MASK) / RVT_BITS_PER_PAGE; if (map->page) clear_bit(qpn & RVT_BITS_PER_PAGE_MASK, map->page); } |