Skip to content

Commit 1958483

Browse files
committed
fix coverity issues in hwloc
1 parent fcf1f5a commit 1958483

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ else()
127127
set(HWLOC_ENABLE_TESTING OFF)
128128
set(HWLOC_SKIP_LSTOPO ON)
129129
set(HWLOC_SKIP_TOOLS ON)
130+
set(HWLOC_PATCH git apply
131+
${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch)
130132

131133
message(
132134
STATUS
@@ -137,7 +139,8 @@ else()
137139
hwloc_targ
138140
GIT_REPOSITORY ${UMF_HWLOC_REPO}
139141
GIT_TAG ${UMF_HWLOC_TAG}
140-
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)
142+
PATCH_COMMAND ${HWLOC_PATCH} SOURCE_SUBDIR contrib/windows-cmake/
143+
FIND_PACKAGE_ARGS)
141144

142145
FetchContent_GetProperties(hwloc_targ)
143146
if(NOT hwloc_targ_POPULATED)
@@ -150,6 +153,9 @@ else()
150153
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)
151154
else()
152155
include(FetchContent)
156+
set(HWLOC_PATCH git apply
157+
${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch)
158+
153159
message(
154160
STATUS
155161
"Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG})"
@@ -158,7 +164,8 @@ else()
158164
FetchContent_Declare(
159165
hwloc_targ
160166
GIT_REPOSITORY ${UMF_HWLOC_REPO}
161-
GIT_TAG ${UMF_HWLOC_TAG})
167+
GIT_TAG ${UMF_HWLOC_TAG}
168+
PATCH_COMMAND ${HWLOC_PATCH})
162169

163170
FetchContent_GetProperties(hwloc_targ)
164171
if(NOT hwloc_targ_POPULATED)

cmake/fix_coverity_issues.patch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/hwloc/topology-x86.c b/hwloc/topology-x86.c
2+
index 7aabd168f..b01e44557 100644
3+
--- a/hwloc/topology-x86.c
4+
+++ b/hwloc/topology-x86.c
5+
@@ -1375,6 +1375,9 @@ look_procs(struct hwloc_backend *backend, struct procinfo *infos, unsigned long
6+
hwloc_bitmap_t set = NULL;
7+
unsigned i;
8+
9+
+ if(!get_cpubind||!set_cpubind)
10+
+ return -1;
11+
+
12+
if (!data->src_cpuiddump_path) {
13+
orig_cpuset = hwloc_bitmap_alloc();
14+
if (get_cpubind(topology, orig_cpuset, HWLOC_CPUBIND_STRICT)) {

0 commit comments

Comments
 (0)