Skip to content

Commit c32d62c

Browse files
committed
linux: properly handle failures to parse /proc/cpuinfo
Signed-off-by: Brice Goglin <[email protected]>
1 parent 5d5ed62 commit c32d62c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hwloc/topology-linux.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4162,7 +4162,7 @@ hwloc_look_linuxfs(struct hwloc_backend *backend)
41624162
struct hwloc_linux_cpuinfo_proc * Lprocs = NULL;
41634163
struct hwloc_obj_info_s *global_infos = NULL;
41644164
unsigned global_infos_count = 0;
4165-
int numprocs = 0;
4165+
int numprocs;
41664166
int already_pus;
41674167
int already_numanodes;
41684168
int err;
@@ -4193,6 +4193,8 @@ hwloc_look_linuxfs(struct hwloc_backend *backend)
41934193
* /proc/cpuinfo
41944194
*/
41954195
numprocs = hwloc_linux_parse_cpuinfo(data, "/proc/cpuinfo", &Lprocs, &global_infos, &global_infos_count);
4196+
if (numprocs < 0)
4197+
numprocs = 0;
41964198

41974199
/**************************
41984200
* detect model for quirks

0 commit comments

Comments
 (0)