Skip to content

Commit

Permalink
Fixed check in DriverGet to verify the dditable pointer is valid
Browse files Browse the repository at this point in the history
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
  • Loading branch information
nrspruit committed Dec 21, 2023
1 parent 1b51637 commit 1685d01
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Level zero loader changelog

## v1.15.7
## v1.15.8
* Fix build when using clang-cl on Windows
* set RUNTIME DESTINATION in install for layer libraries
* added github actions runs on latest windows
* Windows.h replaced with windows.h
* Added support for enabling/disabling tracing layer during runtime
* check in DriverGet to verify the dditable pointer is valid
## v1.15.1
* Fix Windows build for Control Flow Guard Mitigation.
## v1.15.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/templates/libapi.cpp.mako
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ${th.make_func_name(n, tags, obj)}(
return ${X}_RESULT_ERROR_UNINITIALIZED;
}

%if re.match("DriverGet", obj['name']):
%if re.match(r"\w+DriverGet$", th.make_func_name(n, tags, obj)):
if (${x}_lib::context->${n}DdiTable == nullptr) {
return ${X}_RESULT_ERROR_UNINITIALIZED;
}
Expand Down
4 changes: 4 additions & 0 deletions source/lib/ze_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ zeDriverGet(
return ZE_RESULT_ERROR_UNINITIALIZED;
}

if (ze_lib::context->zeDdiTable == nullptr) {
return ZE_RESULT_ERROR_UNINITIALIZED;
}

auto pfnGet = ze_lib::context->zeDdiTable.load()->Driver.pfnGet;
if( nullptr == pfnGet ) {
if(!ze_lib::context->isInitialized)
Expand Down
4 changes: 4 additions & 0 deletions source/lib/zes_libapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ zesDriverGet(
return ZE_RESULT_ERROR_UNINITIALIZED;
}

if (ze_lib::context->zesDdiTable == nullptr) {
return ZE_RESULT_ERROR_UNINITIALIZED;
}

auto pfnGet = ze_lib::context->zesDdiTable.load()->Driver.pfnGet;
if( nullptr == pfnGet ) {
if(!ze_lib::context->isInitialized)
Expand Down

0 comments on commit 1685d01

Please sign in to comment.