linux/arch/s390/hypfs
Gustavo A. R. Silva c6ac875446 s390/hypfs: Use struct_size() in kzalloc()
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 = kzalloc(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 = kzalloc(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: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2019-01-18 09:34:19 +01:00
..
hypfs_dbfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hypfs_diag0c.c s390/hypfs: Use struct_size() in kzalloc() 2019-01-18 09:34:19 +01:00
hypfs_diag.c s390/hypfs: Replace PTR_RET with PTR_ERR_OR_ZERO 2018-07-19 16:37:36 +02:00
hypfs_sprp.c s390/hypfs: do not use stack buffers for hardware data 2018-10-09 11:20:53 +02:00
hypfs_vm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hypfs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
inode.c s390: hypfs: use ktime_get_seconds() instead of get_seconds() 2018-06-25 10:14:41 +02:00
Makefile s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00