Skip to content

Commit 6a77c3c

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

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ 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 ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch)
130131

131132
message(
132133
STATUS
@@ -136,7 +137,8 @@ else()
136137
FetchContent_Declare(
137138
hwloc_targ
138139
GIT_REPOSITORY ${UMF_HWLOC_REPO}
139-
GIT_TAG ${UMF_HWLOC_TAG}
140+
GIT_TAG ${UMF_HWLOC_TAG}
141+
PATCH_COMMAND ${HWLOC_PATCH}
140142
SOURCE_SUBDIR contrib/windows-cmake/ FIND_PACKAGE_ARGS)
141143

142144
FetchContent_GetProperties(hwloc_targ)
@@ -150,6 +152,8 @@ else()
150152
${hwloc_targ_BINARY_DIR}/Release;${hwloc_targ_BINARY_DIR}/Debug)
151153
else()
152154
include(FetchContent)
155+
set(HWLOC_PATCH git apply ${PROJECT_SOURCE_DIR}/cmake/fix_coverity_issues.patch)
156+
153157
message(
154158
STATUS
155159
"Will fetch hwloc from ${UMF_HWLOC_REPO} (tag: ${UMF_HWLOC_TAG})"
@@ -158,7 +162,8 @@ else()
158162
FetchContent_Declare(
159163
hwloc_targ
160164
GIT_REPOSITORY ${UMF_HWLOC_REPO}
161-
GIT_TAG ${UMF_HWLOC_TAG})
165+
GIT_TAG ${UMF_HWLOC_TAG}
166+
PATCH_COMMAND ${HWLOC_PATCH})
162167

163168
FetchContent_GetProperties(hwloc_targ)
164169
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)