[PATCH v4 1/6] arm_mpam: Fix the RIS index range check in mpam_ris_create_locked
Srivathsa L Rao
srivathsa.rao at oss.qualcomm.com
Fri Oct 30 10:15:31 PDT 2026
Hi Yin,
Reviewed by: Srivathsa L Rao <srivathsa.rao at oss.qualcomm.com>
On 10/28/2026 5:15 PM, Yin Li wrote:
> The RIS selector field is defined as MPAMCFG_PART_SEL_RIS (bits 27:24),
> which is 4 bits wide and gives valid indices 0..15. MPAM_MSC_MAX_NUM_RIS
> is defined as 16, so the check should use >= to reject index 16 and
> above. The previous > check incorrectly accepted index 16 as valid.
>
> Fixes: 01fb4b822472 ("arm_mpam: Add the class and component structures for firmware described ris")
> Signed-off-by: Yin Li <yin.li at oss.qualcomm.com>
> Reviewed-by: Andre Przywara <andre.przywara at arm.com>
> Reviewed-by: Ben Horgan <ben.horgan at arm.com>
> ---
> drivers/resctrl/mpam_devices.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index 48adc49b833c..347a5a6d6a1d 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -700,7 +700,7 @@ static int mpam_ris_create_locked(struct mpam_msc *msc, u8 ris_idx,
>
> lockdep_assert_held(&mpam_list_lock);
>
> - if (ris_idx > MPAM_MSC_MAX_NUM_RIS)
> + if (ris_idx >= MPAM_MSC_MAX_NUM_RIS)
> return -EINVAL;
>
> if (test_and_set_bit(ris_idx, &msc->ris_idxs))
>
Best Regards,
Srivathsa
More information about the linux-arm-kernel
mailing list