From: Markus Elfring Date: Sat, 17 Sep 2016 09:44:55 +0000 (+0200) Subject: ste_dma40: Use kmalloc_array() in d40_hw_detect_init() X-Git-Tag: v4.14-rc1~2349^2~3^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28c01058b28527be2a81e8ba2a53437910defbf3;p=platform%2Fkernel%2Flinux-rpi.git ste_dma40: Use kmalloc_array() in d40_hw_detect_init() A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected also by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Linus Walleij Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index a426abd..4892c23 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3301,9 +3301,9 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) if (!base->lookup_log_chans) goto failure; - base->reg_val_backup_chan = kmalloc(base->num_phy_chans * - sizeof(d40_backup_regs_chan), - GFP_KERNEL); + base->reg_val_backup_chan = kmalloc_array(base->num_phy_chans, + sizeof(d40_backup_regs_chan), + GFP_KERNEL); if (!base->reg_val_backup_chan) goto failure;