fix: ensure resource info is created properly
the handle is not validated later, this change prevents nullptr dereference Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
5633418891
commit
b7d96314a0
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -7,17 +7,25 @@
|
||||||
|
|
||||||
#include "shared/source/gmm_helper/resource_info.h"
|
#include "shared/source/gmm_helper/resource_info.h"
|
||||||
|
|
||||||
|
#include "shared/source/helpers/debug_helpers.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
GmmResourceInfo *GmmResourceInfo::create(GmmClientContext *clientContext, GMM_RESCREATE_PARAMS *resourceCreateParams) {
|
GmmResourceInfo *GmmResourceInfo::create(GmmClientContext *clientContext, GMM_RESCREATE_PARAMS *resourceCreateParams) {
|
||||||
return new GmmResourceInfo(clientContext, resourceCreateParams);
|
auto resourceInfo = new GmmResourceInfo(clientContext, resourceCreateParams);
|
||||||
|
UNRECOVERABLE_IF(resourceInfo->peekHandle() == 0);
|
||||||
|
return resourceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmResourceInfo *GmmResourceInfo::create(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmmResourceInfo) {
|
GmmResourceInfo *GmmResourceInfo::create(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmmResourceInfo) {
|
||||||
return new GmmResourceInfo(clientContext, inputGmmResourceInfo);
|
auto resourceInfo = new GmmResourceInfo(clientContext, inputGmmResourceInfo);
|
||||||
|
UNRECOVERABLE_IF(resourceInfo->peekHandle() == 0);
|
||||||
|
return resourceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
GmmResourceInfo *GmmResourceInfo::create(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmmResourceInfo, bool openingHandle) {
|
GmmResourceInfo *GmmResourceInfo::create(GmmClientContext *clientContext, GMM_RESOURCE_INFO *inputGmmResourceInfo, bool openingHandle) {
|
||||||
return new GmmResourceInfo(clientContext, inputGmmResourceInfo, openingHandle);
|
auto resourceInfo = new GmmResourceInfo(clientContext, inputGmmResourceInfo, openingHandle);
|
||||||
|
UNRECOVERABLE_IF(resourceInfo->peekHandle() == 0);
|
||||||
|
return resourceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
Loading…
Reference in New Issue