From patchwork Sat Sep 17 15:15:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9337159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2BD0F60839 for ; Sat, 17 Sep 2016 15:15:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A90528BF3 for ; Sat, 17 Sep 2016 15:15:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A92028C25; Sat, 17 Sep 2016 15:15:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A62AE28BF3 for ; Sat, 17 Sep 2016 15:15:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752115AbcIQPPt (ORCPT ); Sat, 17 Sep 2016 11:15:49 -0400 Received: from mout.web.de ([212.227.17.12]:62616 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbcIQPPs (ORCPT ); Sat, 17 Sep 2016 11:15:48 -0400 Received: from [192.168.1.2] ([78.48.101.40]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0LmLc6-1bClb41hac-00ZxNa; Sat, 17 Sep 2016 17:15:16 +0200 Subject: [PATCH 07/24] ste_dma40: Use kmalloc_array() in d40_hw_detect_init() To: dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dan Williams , Linus Walleij , Vinod Koul References: <566ABCD9.1060404@users.sourceforge.net> <92810066-69b6-94e7-dcec-a28594b1328f@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: Date: Sat, 17 Sep 2016 17:15:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <92810066-69b6-94e7-dcec-a28594b1328f@users.sourceforge.net> X-Provags-ID: V03:K0:BBizjoQptpi+SKY6f9UPRbadhvVnGKZkrR1FK7Xj/NuOw+WqWAY /i+rK5HbeMAtMoivxvE9vowDN2O7R5B73bQYFhQvmGRY2CwpOaYhNT1jQMOGZocqfj5XAyv yy3Fh/AFp4d0/YJNfaMXOqzx6087WmwW/MWK59TNytCyAHUL5bjQRwJZKH944gjT4m+Y0bc Z5kKYhsc2p05J3eViivfg== X-UI-Out-Filterresults: notjunk:1; V01:K0:SKD1WyJ6MEI=:xs4HdTwh07tpOECfxWCD25 SluA5XKt8f02IgWGUX15uBPPFbD+odgJ5I6KDa6ZKI+r+QGXCJQMP941u0PMNClbZmNCfojn1 f9J5XkAPA6Da7qGDs1Ul0vFG88yYgSmD8xdy/Q26Zo7RzC+FmsJ9wa14YSHuQKnFwBr8P4t6k 0poMKWRgfii+LSbeTCfwKTFKcBxcWrEXjNciBGF3QzyQG8ABhbrbUYfi6xDj5xTdQ1ltlpsYV 4HSVKiP0ax+R+M9b2nvzLs0mdyoW8oJnb0HffF/OjE5vNdzW0gijyutfnfcpKkGld/eo+zgbO Lp9thNpVjYplw3iwcmpUAudgTIEPU9Q/Kex+QcFKaGOr8ZEmiACJmACiyKj3p5m9/FIwwSaWK im0Uqb0FO2blj5Qt1zSNhdqp8+Ta++oHaO7lU+XwNG4e1Y03rKhnR1dY+/exWTOGZtqm7U+FH XhcvuySupGLnj4gBD/yGMhrPa8A3lMm9/GX9cOYC1cuoB6Aet/hEhHQxmxHSGQp58uGivmSXf O/pn3S5yMpG4xOdG6hvSfJyYhM82DvPvC4ZGA1zhVdRSYomua8a5msxK5KlnHZxepHqx+TPt+ N7r05qKAKiRxejaQy4oklsBS6d+j3B1VP0qXUkiFuNQ8XW4u5qnJcAYKk8ryKiUTR7xZn7jM9 VSm25dEbNdmNfehfwuRAM25dWvR2N72mB2lF05SWZoB3errwIKCXXZ4DZ06Me/timVQ19xEZK dDP+Cgtsxs0ADRRlsLstIGQPQyulin97HuPAofcAHzp6cvNWZDlZDzkG4tVTHIZ7+THFSr/rP +ywwFdD Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 17 Sep 2016 11:44:55 +0200 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 --- drivers/dma/ste_dma40.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index b5d15a1..f813056 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3299,9 +3299,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;