Skip to content

Commit 8a620c0

Browse files
Merge pull request #1973 from omarahmed1111/fix-coverity-issues
Fix some coverity issues
2 parents 3974c6f + e9c705d commit 8a620c0

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

source/loader/layers/sanitizer/asan_interceptor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct DeviceInfo {
4343
uptr ShadowOffsetEnd = 0;
4444

4545
// Device features
46-
bool IsSupportSharedSystemUSM;
46+
bool IsSupportSharedSystemUSM = false;
4747

4848
ur_mutex Mutex;
4949
std::queue<std::shared_ptr<AllocInfo>> Quarantine;

source/loader/layers/sanitizer/stacktrace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void StackTrace::print() const {
9999
uptr Offset;
100100
ParseBacktraceInfo(BI, ModuleName, Offset);
101101
if (SymbolizeCode(ModuleName, Offset, Result)) {
102-
SourceInfo SrcInfo = ParseSymbolizerOutput(Result);
102+
SourceInfo SrcInfo = ParseSymbolizerOutput(std::move(Result));
103103
if (SrcInfo.file != "??") {
104104
getContext()->logger.always(" #{} in {} {}:{}:{}", index,
105105
SrcInfo.function, SrcInfo.file,

test/layers/validation/fixtures.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ inline ur_result_t genericSuccessCallback(void *) { return UR_RESULT_SUCCESS; };
133133
// This returns valid (non-null) handles that we can safely leak.
134134
inline ur_result_t fakeContext_urContextCreate(void *pParams) {
135135
static std::atomic_int handle = 42;
136-
auto params = *static_cast<ur_context_create_params_t *>(pParams);
136+
const auto &params = *static_cast<ur_context_create_params_t *>(pParams);
137137
// There are two casts because windows doesn't implicitly extend the 32 bit
138138
// result of atomic_int::operator++.
139139
**params.pphContext =

test/layers/validation/leaks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
// We need a fake handle for the below adapter leak test.
1111
inline ur_result_t fakeAdapter_urAdapterGet(void *pParams) {
12-
auto params = *static_cast<ur_adapter_get_params_t *>(pParams);
12+
const auto &params = *static_cast<ur_adapter_get_params_t *>(pParams);
1313
**params.pphAdapters = reinterpret_cast<ur_adapter_handle_t>(0x1);
1414
return UR_RESULT_SUCCESS;
1515
}

test/loader/handles/fixtures.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#endif
1616

1717
ur_result_t replace_urPlatformGet(void *pParams) {
18-
auto params = *static_cast<ur_platform_get_params_t *>(pParams);
18+
const auto &params = *static_cast<ur_platform_get_params_t *>(pParams);
1919

2020
if (*params.ppNumPlatforms) {
2121
**params.ppNumPlatforms = 1;
@@ -29,7 +29,7 @@ ur_result_t replace_urPlatformGet(void *pParams) {
2929
}
3030

3131
ur_result_t replace_urDeviceGetInfo(void *pParams) {
32-
auto params = *static_cast<ur_device_get_info_params_t *>(pParams);
32+
const auto &params = *static_cast<ur_device_get_info_params_t *>(pParams);
3333
if (*params.ppropName == UR_DEVICE_INFO_PLATFORM) {
3434
if (*params.ppPropSizeRet) {
3535
**params.ppPropSizeRet = sizeof(ur_platform_handle_t);

0 commit comments

Comments
 (0)