[PATCH] arm_mpam: resctrl: Catch and propagate error from get_cpu_cacheinfo_id()

Yin Li yin.li at oss.qualcomm.com
Sun Sep 13 22:50:34 PDT 2026



On 9/2/2026 10:37 PM, 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 at arm.com>
> ---
>   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();
>   

Hi Andre

This looks good to me.

Reviewed-by: Yin Li<yin.li at oss.qualcomm.com>

-- 
Thx and BRs,
Yin




More information about the linux-arm-kernel mailing list