summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorxiaolinkui <xiaolinkui@kylinos.cn>2019-05-17 15:15:17 +0800
committerHeiko Carstens <heiko.carstens@de.ibm.com>2019-06-04 15:03:18 +0200
commit31885a8dad16a319a394d82807c3b708882b50a1 (patch)
treeaeea6449edf3bf52d0fdcb8ee14ca4b82e73e17f /arch
parenta646ef398e72a2ac40bea974808ffcf1bea4e7f4 (diff)
downloadlinux-31885a8dad16a319a394d82807c3b708882b50a1.tar.bz2
s390/idal: use struct_size() in kmalloc()
Use the new struct_size() helper to keep code simple. Signed-off-by: xiaolinkui <xiaolinkui@kylinos.cn> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/idals.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/s390/include/asm/idals.h b/arch/s390/include/asm/idals.h
index 15578fd762f6..6fb7aced104a 100644
--- a/arch/s390/include/asm/idals.h
+++ b/arch/s390/include/asm/idals.h
@@ -122,8 +122,7 @@ idal_buffer_alloc(size_t size, int page_order)
nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
nr_chunks = (4096 << page_order) >> IDA_SIZE_LOG;
- ib = kmalloc(sizeof(struct idal_buffer) + nr_ptrs*sizeof(void *),
- GFP_DMA | GFP_KERNEL);
+ ib = kmalloc(struct_size(ib, data, nr_ptrs), GFP_DMA | GFP_KERNEL);
if (ib == NULL)
return ERR_PTR(-ENOMEM);
ib->size = size;