linux_dsm_epyc7002/arch/powerpc/platforms
Gustavo A. R. Silva 00def7130a powerpc/spufs: use struct_size() in kmalloc()
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
    int stuff;
    void *entry[];
};

instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2019-01-14 20:39:27 +11:00
..
4xx powerpc/4xx/ocm: Fix phys_addr_t printf warnings 2018-12-30 14:00:47 +11:00
8xx powerpc updates for 4.20 2018-10-26 14:36:21 -07:00
40x PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
44x Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
52xx Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
82xx powerpc/kconfig: remove CONFIG_6xx 2018-11-26 22:33:37 +11:00
83xx Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
85xx Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
86xx Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
512x Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
amigaone Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
cell powerpc/spufs: use struct_size() in kmalloc() 2019-01-14 20:39:27 +11:00
chrp Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
embedded6xx Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
maple Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
pasemi cross-tree: phase out dma_zalloc_coherent() 2019-01-08 07:58:37 -05:00
powermac Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
powernv jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
ps3 powerpc/ps3: Use struct_size() in kzalloc() 2019-01-14 20:39:27 +11:00
pseries jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
fsl_uli1575.c
Kconfig Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
Kconfig.cputype Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
Makefile powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00