Re: [PATCH -next] irqdomain: fix overflow error

From: Thomas Gleixner
Date: Tue Sep 14 2021 - 07:56:40 EST


On Wed, Sep 08 2021 at 09:46, Bixuan Cui wrote:
> In function ‘kmalloc_node’,
> inlined from ‘kzalloc_node.constprop’ at ./include/linux/slab.h:743:9,
> inlined from ‘__irq_domain_add’ at kernel/irq/irqdomain.c:153:9:
> ./include/linux/slab.h:618:9: error: argument 1 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
> return __kmalloc_node(size, flags, node);
>
> The 'size' can be negative here, which will then get turned into a giant
> size argument for kzalloc_node(). Changing the size to 'unsigned int'
> instead seems more appropriate.

What's more appropriate about that?

Thanks,

tglx