提交 642c7cbc 编写于 作者: B Bart Van Assche 提交者: Doug Ledford

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: NBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: NAndrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 43553b47
...@@ -266,6 +266,7 @@ static u32 alloc_index(struct rxe_pool *pool) ...@@ -266,6 +266,7 @@ static u32 alloc_index(struct rxe_pool *pool)
if (index >= range) if (index >= range)
index = find_first_zero_bit(pool->table, range); index = find_first_zero_bit(pool->table, range);
WARN_ON_ONCE(index >= range);
set_bit(index, pool->table); set_bit(index, pool->table);
pool->last = index; pool->last = index;
return index + pool->min_index; return index + pool->min_index;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册