Fix array allocation for non-continuous cpu numbers

Authored by cfeck on Feb 17 2017, 2:09 AM.



As per ksysguard crashes, when /proc/stat returns the following file:

cpu0 x y z
cpu3 x y z

The issue is that it counts two CPUs, and later allocates two entries for the array, but uses the CPU number to index that array. An array with indices 0 and 3 should have 4 entries, not 2.

Test Plan

Compiled. Could not test, because this is an SMP machine.

Diff Detail

R106 KSysguard
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
cfeck updated this revision to Diff 11423.Feb 17 2017, 2:09 AM
cfeck retitled this revision from to Fix array allocation for non-continuous cpu numbers.
cfeck updated this object.
cfeck edited the test plan for this revision. (Show Details)
cfeck added a reviewer: Plasma.
cfeck set the repository for this revision to R106 KSysguard.
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 17 2017, 2:09 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart accepted this revision.Feb 17 2017, 3:03 PM
mart added a reviewer: mart.
This revision is now accepted and ready to land.Feb 17 2017, 3:03 PM
This revision was automatically updated to reflect the committed changes.