From: Ben Horgan <ben.horgan@arm.com>
To: Andre Przywara <andre.przywara@arm.com>,
James Morse <james.morse@arm.com>
Cc: Reinette Chatre <reinette.chatre@intel.com>,
Fenghua Yu <fenghuay@nvidia.com>, Tony Luck <tony.luck@intel.com>,
Dave Martin <Dave.Martin@arm.com>,
Yin Li <yin.li@oss.qualcomm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm_mpam: resctrl: Catch and propagate error from get_cpu_cacheinfo_id()
Date: Mon, 7 Sep 2026 13:59:14 +0100 [thread overview]
Message-ID: <ea42f2a7-f4f7-46ab-a5e0-239c74174499@arm.com> (raw)
In-Reply-To: <20260902143757.3469690-1-andre.przywara@arm.com>
Hi Andre,
On 02/09/2026 15:37, Andre Przywara wrote:
> get_cpu_cacheinfo_id() can fail, in which case it returns a negative
> error value.
>
> Check the returned value for this error condition, before passing the
> value on to other code, which would hide the negative number in some high
> value in the unsigned type.
>
> Fixes: 36528c7681b8 ("arm_mpam: resctrl: Add support for 'MB' resource")
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This looks good to me. Out of interest what led you to find this?
Reviewed-by: Ben Horgan <ben.horgan@arm.com>
Thanks,
Ben
> ---
> drivers/resctrl/mpam_resctrl.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 9d223057953ab..a5e661eff86d7 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -786,7 +786,10 @@ static u32 get_mba_min(struct mpam_props *cprops)
> /* Find the L3 cache that has affinity with this CPU */
> static int find_l3_equivalent_bitmask(int cpu, cpumask_var_t tmp_cpumask)
> {
> - u32 cache_id = get_cpu_cacheinfo_id(cpu, 3);
> + int cache_id = get_cpu_cacheinfo_id(cpu, 3);
> +
> + if (cache_id < 0)
> + return -ENOENT;
>
> lockdep_assert_cpus_held();
>
next prev parent reply other threads:[~2026-09-07 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 14:37 [PATCH] arm_mpam: resctrl: Catch and propagate error from get_cpu_cacheinfo_id() Andre Przywara
2026-09-07 12:59 ` Ben Horgan [this message]
2026-09-07 13:14 ` Andre Przywara
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=ea42f2a7-f4f7-46ab-a5e0-239c74174499@arm.com \
--to=ben.horgan@arm.com \
--cc=Dave.Martin@arm.com \
--cc=andre.przywara@arm.com \
--cc=fenghuay@nvidia.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=tony.luck@intel.com \
--cc=yin.li@oss.qualcomm.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