Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
python-libmount
util-linux-lscpu-loop.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-lscpu-loop.patch of Package python-libmount
From 95f09bc63c564c50ec2c393352801cc056faaea2 Mon Sep 17 00:00:00 2001 From: Dirk Mueller <dmueller@suse.com> Date: Sat, 17 Mar 2018 13:18:38 +0100 Subject: [PATCH] Avoid crash in min/max caculation when cpu#0 being offline When cpu#0 is offline, atof(NULL) is called which causes a segfault or endless loop depending on implementation circumstances. So instead of implicitely assumping that the first cpu is always available, do the presence checks for all including the first one. --- sys-utils/lscpu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Index: util-linux-2.29.2/sys-utils/lscpu.c =================================================================== --- util-linux-2.29.2.orig/sys-utils/lscpu.c +++ util-linux-2.29.2/sys-utils/lscpu.c @@ -1253,10 +1253,10 @@ static void cpu_max_mhz(struct lscpu_desc *desc, char *max_freq) { int i; - float cpu_freq = atof(desc->maxmhz[0]); + float cpu_freq = 0.0; if (desc->present) { - for (i = 1; i < desc->ncpuspos; i++) { + for (i = 0; i < desc->ncpuspos; i++) { if (CPU_ISSET(real_cpu_num(desc, i), desc->present) && desc->maxmhz[i]) { float freq = atof(desc->maxmhz[i]); @@ -1273,16 +1273,16 @@ cpu_max_mhz(struct lscpu_desc *desc, cha static void cpu_min_mhz(struct lscpu_desc *desc, char *min_freq) { - int i; - float cpu_freq = atof(desc->minmhz[0]); + int i; + float cpu_freq = -1.0; if (desc->present) { - for (i = 1; i < desc->ncpuspos; i++) { + for (i = 0; i < desc->ncpuspos; i++) { if (CPU_ISSET(real_cpu_num(desc, i), desc->present) && desc->minmhz[i]) { float freq = atof(desc->minmhz[i]); - if (freq < cpu_freq) + if (cpu_freq < 0.0 || freq < cpu_freq) cpu_freq = freq; } }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor