mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Do not create buffer when size is too big.
Resolves: NEO-3131 Change-Id: Icd37e7bc62719be5956b6a9435ab2fe7e0962c00 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b98b51b0d9
commit
7830be3090
@@ -82,7 +82,14 @@ void Buffer::validateInputAndCreateBuffer(cl_context &context,
|
||||
void *hostPtr,
|
||||
cl_int &retVal,
|
||||
cl_mem &buffer) {
|
||||
if (size == 0) {
|
||||
Context *pContext = nullptr;
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext));
|
||||
if (retVal != CL_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto pDevice = pContext->getDevice(0);
|
||||
if (size == 0 || size > pDevice->getDeviceInfo().maxMemAllocSize) {
|
||||
retVal = CL_INVALID_BUFFER_SIZE;
|
||||
return;
|
||||
}
|
||||
@@ -99,12 +106,6 @@ void Buffer::validateInputAndCreateBuffer(cl_context &context,
|
||||
return;
|
||||
}
|
||||
|
||||
Context *pContext = nullptr;
|
||||
retVal = validateObjects(WithCastToInternal(context, &pContext));
|
||||
if (retVal != CL_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
// create the buffer
|
||||
buffer = create(pContext, properties, size, hostPtr, retVal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user