projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
091f9f7
)
x86/PCI: Use struct_size() in pirq_convert_irt_table()
author
Christophe JAILLET
<christophe.jaillet@wanadoo.fr>
Fri, 19 May 2023 17:42:28 +0000
(19:42 +0200)
committer
Bjorn Helgaas
<bhelgaas@google.com>
Thu, 13 Jul 2023 16:33:20 +0000
(11:33 -0500)
Use struct_size() instead of hand-writing it. It is less verbose, more
robust and more informative.
Link:
https://lore.kernel.org/r/00a5cc2cd322e7dea26579916ac6dda9c637aa57.1684518118.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
arch/x86/pci/irq.c
patch
|
blob
|
history
diff --git
a/arch/x86/pci/irq.c
b/arch/x86/pci/irq.c
index
a498b84
..
0de4363
100644
(file)
--- a/
arch/x86/pci/irq.c
+++ b/
arch/x86/pci/irq.c
@@
-136,14
+136,14
@@
static inline struct irq_routing_table *pirq_convert_irt_table(u8 *addr,
if (ir->signature != IRT_SIGNATURE || !ir->used || ir->size < ir->used)
return NULL;
- size = s
izeof(*ir) + ir->used * sizeof(ir->slots[0]
);
+ size = s
truct_size(ir, slots, ir->used
);
if (size > limit - addr)
return NULL;
DBG(KERN_DEBUG "PCI: $IRT Interrupt Routing Table found at 0x%lx\n",
__pa(ir));
- size = s
izeof(*rt) + ir->used * sizeof(rt->slots[0]
);
+ size = s
truct_size(rt, slots, ir->used
);
rt = kzalloc(size, GFP_KERNEL);
if (!rt)
return NULL;