From: Gustavo A. R. Silva Date: Thu, 8 Oct 2020 14:18:28 +0000 (-0500) Subject: dmaengine: stm32-mdma: Use struct_size() in kzalloc() X-Git-Tag: Ubuntu-5.11.0-11.12~803^2~74 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8145dce88a788f178dfe19376e5d8645d1b87e05;p=mirror_ubuntu-hirsute-kernel.git dmaengine: stm32-mdma: Use struct_size() in kzalloc() Make use of the new struct_size() helper instead of the offsetof() idiom. Signed-off-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20201008141828.GA20325@embeddedor Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index 08cfbfab837b..29e5e30524bb 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -339,7 +339,7 @@ static struct stm32_mdma_desc *stm32_mdma_alloc_desc( struct stm32_mdma_desc *desc; int i; - desc = kzalloc(offsetof(typeof(*desc), node[count]), GFP_NOWAIT); + desc = kzalloc(struct_size(desc, node, count), GFP_NOWAIT); if (!desc) return NULL;