https://bugs.kde.org/show_bug.cgi?id=495524

Joshua Goins <j...@redstrate.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/plas |https://invent.kde.org/plas
                   |ma/ksystemstats/-/commit/2f |ma/ksystemstats/-/commit/23
                   |0903224c21e9e1107063d3ae4ad |f8291aec1c1123e240187280174
                   |abed25f555b                 |c336dc9df57

--- Comment #16 from Joshua Goins <j...@redstrate.com> ---
Git commit 23f8291aec1c1123e240187280174c336dc9df57 by Joshua Goins, on behalf
of Hector Martin.
Committed on 13/11/2024 at 13:17.
Pushed by redstrate into branch 'Plasma/6.2'.

plugins/cpu: Test for the proper CPU property, skip nonexistent CPUs

Commit 478e766d19b3 regressed ksystemstats on many ARM systems, since it
mistakenly tests the "cpu" property of the CPU object (which is is the
"physical id") and not the "id" property (which is the actual CPU
number). For systems without a "physical id", this ignores all CPUs and
ends up crashing on a NULL deref later when it tries to look up CPU
numbers from /proc/stat.

Fix the incorrect check and add an extra NULL guard, so if we fail to
parse /proc/cpuinfo properly we don't crash. We only need an "id"
property to consider the CPU object valid, and that property is required
to identify the CPU in the first place, so it is the only one that needs
to be tested.

Also guard insertion into m_cpusBySystemIds if the keys do not exist
(this is what wants `cpu` and `core`). This isn't strictly necessary,
but more correct. Consumers of that already test for entries correctly
and don't segfault if missing.
Fixes: 478e766d19b3 ("plugins/cpu: Ignore invalid CPU info when reading
/proc/cpuinfo")
(cherry picked from commit 2f0903224c21e9e1107063d3ae4adabed25f555b)

M  +10   -4    plugins/cpu/linuxcpuplugin.cpp

https://invent.kde.org/plasma/ksystemstats/-/commit/23f8291aec1c1123e240187280174c336dc9df57

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to