Skip to content

Commit

Permalink
Merge pull request #1277 from pbalcer/l0-coverity-fixes
Browse files Browse the repository at this point in the history
[L0] fix coverity issues
  • Loading branch information
kbenzie committed Jan 25, 2024
2 parents 9b97a5f + 05c3b0d commit cdde496
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions source/adapters/level_zero/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//===----------------------------------------------------------------------===//

#include "kernel.hpp"
#include "ur_api.h"
#include "ur_level_zero.hpp"

UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
Expand Down Expand Up @@ -48,6 +49,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch(
ZeKernel = Kernel->ZeKernel;
} else {
auto It = Kernel->ZeKernelMap.find(ZeDevice);
if (It == Kernel->ZeKernelMap.end()) {
/* kernel and queue don't match */
return UR_RESULT_ERROR_INVALID_QUEUE;
}
ZeKernel = It->second;
}
// Lock automatically releases when this goes out of scope.
Expand Down
2 changes: 1 addition & 1 deletion source/adapters/level_zero/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

struct ur_kernel_handle_t_ : _ur_object {
ur_kernel_handle_t_(bool OwnZeHandle, ur_program_handle_t Program)
: Program{Program}, SubmissionsCount{0}, MemAllocs{} {
: Context{nullptr}, Program{Program}, SubmissionsCount{0}, MemAllocs{} {
OwnNativeHandle = OwnZeHandle;
}

Expand Down
4 changes: 2 additions & 2 deletions source/adapters/level_zero/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramLinkExp(
new ur_program_handle_t_(State, hContext, ZeModuleMap.begin()->second,
ZeBuildLogMap.begin()->second);
*phProgram = reinterpret_cast<ur_program_handle_t>(UrProgram);
(*phProgram)->ZeModuleMap = ZeModuleMap;
(*phProgram)->ZeBuildLogMap = ZeBuildLogMap;
(*phProgram)->ZeModuleMap = std::move(ZeModuleMap);
(*phProgram)->ZeBuildLogMap = std::move(ZeBuildLogMap);
} catch (const std::bad_alloc &) {
return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
} catch (...) {
Expand Down

0 comments on commit cdde496

Please sign in to comment.