Skip to content

Commit 426fa31

Browse files
author
Marc Zyngier
committed
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 <[email protected]>
1 parent 4f86a06 commit 426fa31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/irq/irqdomain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
150150
(!IS_ENABLED(CONFIG_IRQ_DOMAIN_NOMAP) && direct_max)))
151151
return NULL;
152152

153-
domain = kzalloc_node(sizeof(*domain) + (sizeof(unsigned int) * size),
153+
domain = kzalloc_node(struct_size(domain, revmap, size),
154154
GFP_KERNEL, of_node_to_nid(to_of_node(fwnode)));
155155
if (!domain)
156156
return NULL;

0 commit comments

Comments
 (0)