Skip to contentSkip to conversation

dmaengine: stm32-mdma: Use struct_size() in kzalloc()

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Oct 8, 2020 – Oct 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: stm32-mdma: Use struct_size() in kzalloc()

Make use of the new struct_size() helper instead of the offsetof() idiom.

---
 drivers/dma/stm32-mdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/stm32-mdma.c +1 -1
index 08cfbfab837b..29e5e30524bb 100644
@@ -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;
 
Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw
Quoted 1 line · Gustavo A. R. Silva

Make use of the new struct_size() helper instead of the offsetof() idiom.

Applied, thanks

Signature · 6 lines
~Vinod

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel