Skip to content

Commit 87b2722

Browse files
committed
[L0 v2] check alignment in USM allocate functions
1 parent 8448f78 commit 87b2722

File tree

1 file changed

+4
-0
lines changed
  • source/adapters/level_zero/v2

1 file changed

+4
-0
lines changed

source/adapters/level_zero/v2/usm.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ ur_result_t ur_usm_pool_handle_t_::allocate(
200200
ur_usm_type_t type, size_t size, void **ppRetMem) {
201201
uint32_t alignment = pUSMDesc ? pUSMDesc->align : 0;
202202

203+
if ((alignment & (alignment - 1)) != 0) {
204+
return UR_RESULT_ERROR_INVALID_VALUE;
205+
}
206+
203207
auto umfPool =
204208
getPool(usm::pool_descriptor{this, hContext, hDevice, type, false});
205209
if (!umfPool) {

0 commit comments

Comments
 (0)