Skip to content

Commit 1685d01

Browse files
committed
Fixed check in DriverGet to verify the dditable pointer is valid
Signed-off-by: Spruit, Neil R <[email protected]>
1 parent 1b51637 commit 1685d01

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Level zero loader changelog
22

3-
## v1.15.7
3+
## v1.15.8
44
* Fix build when using clang-cl on Windows
55
* set RUNTIME DESTINATION in install for layer libraries
66
* added github actions runs on latest windows
77
* Windows.h replaced with windows.h
88
* Added support for enabling/disabling tracing layer during runtime
9+
* check in DriverGet to verify the dditable pointer is valid
910
## v1.15.1
1011
* Fix Windows build for Control Flow Guard Mitigation.
1112
## v1.15.0

scripts/templates/libapi.cpp.mako

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ ${th.make_func_name(n, tags, obj)}(
113113
return ${X}_RESULT_ERROR_UNINITIALIZED;
114114
}
115115

116-
%if re.match("DriverGet", obj['name']):
116+
%if re.match(r"\w+DriverGet$", th.make_func_name(n, tags, obj)):
117117
if (${x}_lib::context->${n}DdiTable == nullptr) {
118118
return ${X}_RESULT_ERROR_UNINITIALIZED;
119119
}

source/lib/ze_libapi.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ zeDriverGet(
114114
return ZE_RESULT_ERROR_UNINITIALIZED;
115115
}
116116

117+
if (ze_lib::context->zeDdiTable == nullptr) {
118+
return ZE_RESULT_ERROR_UNINITIALIZED;
119+
}
120+
117121
auto pfnGet = ze_lib::context->zeDdiTable.load()->Driver.pfnGet;
118122
if( nullptr == pfnGet ) {
119123
if(!ze_lib::context->isInitialized)

source/lib/zes_libapi.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ zesDriverGet(
109109
return ZE_RESULT_ERROR_UNINITIALIZED;
110110
}
111111

112+
if (ze_lib::context->zesDdiTable == nullptr) {
113+
return ZE_RESULT_ERROR_UNINITIALIZED;
114+
}
115+
112116
auto pfnGet = ze_lib::context->zesDdiTable.load()->Driver.pfnGet;
113117
if( nullptr == pfnGet ) {
114118
if(!ze_lib::context->isInitialized)

0 commit comments

Comments
 (0)