Skip to content

Commit 8317262

Browse files
committed
fix coverity
1 parent 8c604b0 commit 8317262

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

source/loader/layers/sanitizer/linux/san_utils.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern "C" __attribute__((weak)) void __asan_init(void);
2222

2323
namespace ur_sanitizer_layer {
2424

25-
bool IsInASanContext() { return __asan_init != nullptr; }
25+
bool IsInASanContext() { return (void *)__asan_init != nullptr; }
2626

2727
static bool ReserveShadowMem(uptr Addr, uptr Size) {
2828
Size = RoundUpTo(Size, EXEC_PAGESIZE);
@@ -71,15 +71,11 @@ bool DestroyShadowMem() {
7171
}
7272

7373
void *GetMemFunctionPointer(const char *FuncName) {
74-
void *handle = dlopen(LIBC_SO, RTLD_LAZY);
74+
void *handle = dlopen(LIBC_SO, RTLD_NOLOAD);
7575
if (!handle) {
76-
return (void *)nullptr;
76+
return nullptr;
7777
}
78-
void *ptr = dlsym(handle, FuncName);
79-
if (!ptr) {
80-
return (void *)nullptr;
81-
}
82-
return ptr;
78+
return dlsym(handle, FuncName);
8379
}
8480

8581
} // namespace ur_sanitizer_layer

0 commit comments

Comments
 (0)