From: Marc Zyngier Date: Mon, 5 Apr 2021 10:30:51 +0000 (+0100) Subject: irqdomain: Use struct_size() helper when allocating irqdomain X-Git-Tag: v5.15~729^2^2~3^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=426fa316148bccabf48f9c91a13c387ee911eadc;p=platform%2Fkernel%2Flinux-starfive.git irqdomain: Use struct_size() helper when allocating irqdomain Instead of open-coding the size computation of struct irqdomain, use the struct_size() helper instead. This is going to be handy as we change the type of the revmap array. Signed-off-by: Marc Zyngier --- diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index fa94c86..cdcb198 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -150,7 +150,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size, (!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max))) return NULL; - domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size), + domain = kzalloc_node(struct_size(domain, revmap, size), GFP_KERNEL, of_node_to_nid(to_of_node(fwnode))); if (!domain) return NULL;