[PATCH v2 09/10] irqchip/gic-v5: Clean the allocated linear device table size

Lorenzo Pieralisi lpieralisi at kernel.org
Wed Nov 4 23:37:59 PST 2026


On Wed, Nov 04, 2026 at 05:48:03PM +0000, Sascha Bischoff wrote:
> When the linear device table exceeds the kmalloc limit, the driver
> caps the DeviceID width before allocation but keeps the original size
> for cache maintenance. On a noncoherent ITS, this cleans beyond the
> allocated table.
> 
> Recalculate the size after capping the DeviceID width.
> 
> Fixes: 57d72196dfc85 ("irqchip/gic-v5: Add GICv5 ITS support")
> Signed-off-by: Sascha Bischoff <sascha.bischoff at arm.com>
> ---
>  drivers/irqchip/irq-gic-v5-its.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Lorenzo Pieralisi <lpieralisi at kernel.org>

> diff --git a/drivers/irqchip/irq-gic-v5-its.c b/drivers/irqchip/irq-gic-v5-its.c
> index 4de07bbdc4923..aebab9f306476 100644
> --- a/drivers/irqchip/irq-gic-v5-its.c
> +++ b/drivers/irqchip/irq-gic-v5-its.c
> @@ -594,14 +594,14 @@ static int gicv5_its_alloc_devtab_linear(struct gicv5_its_chip_data *its,
>  	 * kmalloc limits so that the system can chug along with a linear
>  	 * device table.
>  	 */
> -	sz = BIT_ULL(device_id_bits) * sizeof(*devtab);
> -	if (sz > KMALLOC_MAX_SIZE) {
> -		u8 device_id_cap = ilog2(KMALLOC_MAX_SIZE/sizeof(*devtab));
> +	if (BIT_ULL(device_id_bits) * sizeof(*devtab) > KMALLOC_MAX_SIZE) {
> +		u8 device_id_cap = ilog2(KMALLOC_MAX_SIZE / sizeof(*devtab));
>  
>  		pr_warn("Limiting device ID bits from %u to %u\n",
>  			device_id_bits, device_id_cap);
>  		device_id_bits = device_id_cap;
>  	}
> +	sz = BIT_ULL(device_id_bits) * sizeof(*devtab);
>  
>  	devtab = kcalloc(BIT(device_id_bits), sizeof(*devtab), GFP_KERNEL);
>  	if (!devtab)
> 
> -- 
> 2.34.1
> 



More information about the linux-arm-kernel mailing list