Skip to content

Commit 7b2aae5

Browse files
Merge pull request #691 from bratpiorka/rrudnick_fix_hwloc_cov
fix coverity issues in hwloc
2 parents 19c67d1 + 2bfecdd commit 7b2aae5

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ else()
127127
set(HWLOC_ENABLE_TESTING OFF)
128128
set(HWLOC_SKIP_LSTOPO ON)
129129
set(HWLOC_SKIP_TOOLS ON)
130+
set(HWLOC_PATCH
131+
git
132+
apply
133+
${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch
134+
||
135+
true)
130136

131137
message(
132138
STATUS
@@ -137,7 +143,8 @@ else()
137143
hwloc_targ
138144
GIT_REPOSITORY ${UMF_HWLOC_REPO}
139145
GIT_TAG ${UMF_HWLOC_TAG}
140-
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)
146+
PATCH_COMMAND ${HWLOC_PATCH} SOURCE_SUBDIR contrib/windows-cmake/
147+
FIND_PACKAGE_ARGS)
141148

142149
FetchContent_GetProperties(hwloc_targ)
143150
if(NOT hwloc_targ_POPULATED)
@@ -150,6 +157,13 @@ else()
150157
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)
151158
else()
152159
include(FetchContent)
160+
set(HWLOC_PATCH
161+
git
162+
apply
163+
${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch
164+
||
165+
true)
166+
153167
message(
154168
STATUS
155169
"Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG})"
@@ -158,7 +172,8 @@ else()
158172
FetchContent_Declare(
159173
hwloc_targ
160174
GIT_REPOSITORY ${UMF_HWLOC_REPO}
161-
GIT_TAG ${UMF_HWLOC_TAG})
175+
GIT_TAG ${UMF_HWLOC_TAG}
176+
PATCH_COMMAND ${HWLOC_PATCH})
162177

163178
FetchContent_GetProperties(hwloc_targ)
164179
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)