From: Shuah <shuah@kernel.org>
To: Ali Ahmet Memis <ali@iusegentoo.com>, Thomas Renninger <trenn@suse.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"John B . Wyatt IV" <jwyatt@redhat.com>,
John Kacur <jkacur@redhat.com>,
stable@vger.kernel.org, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] cpupower: Avoid uninitialized reads in topology sorting
Date: Mon, 3 Aug 2026 10:29:15 -0600 [thread overview]
Message-ID: <c746110c-6ac4-4500-a4f0-491a06838173@kernel.org> (raw)
In-Reply-To: <7fa98ba5-6790-48b4-b102-c1193685822f@smtp-relay.sendinblue.com>
On 7/29/26 20:07, Ali Ahmet Memis wrote:
>
> get_cpu_topology() allocates core_info with malloc(). If a topology
> attribute disappears while CPUs are being hotplugged, an error path can
> leave core_cpu_list uninitialized. __compare_core_cpu_list() then passes
> the field to strcmp() while sorting the array.
>
> Use calloc() for the array and ignore entries without complete topology
> data when counting cores. Besides avoiding the invalid read, this keeps an
> incomplete entry from being counted as a physical core.
>
> Fixes: f89cb9cba7a2 ("cpupower: Implement CPU physical core querying")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ali Ahmet Memis <ali@iusegentoo.com>
> ---
> Tested with a two-CPU topology mock that makes the second CPU's sysfs
> reads fail. Valgrind reports uninitialized reads before this patch and
> no errors after it.
>
> Build-tested with:
> make -C tools/power/cpupower NLS=false CPUFREQ_BENCH=false
Sorry I am not taking this patch.
Please note that build test just verifies that the code build which
fall way short of testing the changed code.
thanks,
-- Shuah
next parent reply other threads:[~2026-08-03 16:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <7fa98ba5-6790-48b4-b102-c1193685822f@smtp-relay.sendinblue.com>
2026-08-03 16:29 ` Shuah [this message]
2026-08-03 16:36 ` [PATCH] cpupower: Avoid uninitialized reads in topology sorting Ali Ahmet Memis
2026-08-03 17:37 ` Shuah
2026-07-30 2:07 Ali Ahmet Memis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c746110c-6ac4-4500-a4f0-491a06838173@kernel.org \
--to=shuah@kernel.org \
--cc=ali@iusegentoo.com \
--cc=jkacur@redhat.com \
--cc=jwyatt@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
--cc=trenn@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox