aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/sw/rxe/rxe_pool.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-01-10 11:15:48 -0800
committerDoug Ledford <dledford@redhat.com>2017-01-10 16:52:47 -0500
commit642c7cbcaf2ffc1e27f67eda3dc47347ac5aff37 (patch)
treeba51621bc1e85f16c12cb0ce65f68dbb72293680 /drivers/infiniband/sw/rxe/rxe_pool.c
parentIB/rxe: Issue warnings once (diff)
downloadlinux-dev-642c7cbcaf2ffc1e27f67eda3dc47347ac5aff37.tar.xz
linux-dev-642c7cbcaf2ffc1e27f67eda3dc47347ac5aff37.zip
IB/rxe: Add a runtime check in alloc_index()
Since index values equal to or above 'range' can trigger memory corruption, complain if index >= range. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Andrew Boyer <andrew.boyer@dell.com> Cc: Moni Shoua <monis@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_pool.c')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_pool.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
index 7d1e2862b928..75d11ee635ec 100644
--- a/drivers/infiniband/sw/rxe/rxe_pool.c
+++ b/drivers/infiniband/sw/rxe/rxe_pool.c
@@ -266,6 +266,7 @@ static u32 alloc_index(struct rxe_pool *pool)
if (index >= range)
index = find_first_zero_bit(pool->table, range);
+ WARN_ON_ONCE(index >= range);
set_bit(index, pool->table);
pool->last = index;
return index + pool->min_index;