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: 9337167 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 B0E5260839 for ; Sat, 17 Sep 2016 15:17:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1CE828C13 for ; Sat, 17 Sep 2016 15:17:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 964E528C5C; Sat, 17 Sep 2016 15:17:10 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 340CC28C13 for ; Sat, 17 Sep 2016 15:17:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1blHLI-0006zw-BQ; Sat, 17 Sep 2016 15:15:48 +0000 Received: from mout.web.de ([212.227.17.12]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1blHLE-0006SE-CD for linux-arm-kernel@lists.infradead.org; Sat, 17 Sep 2016 15:15:45 +0000 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> 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160917_081544_858897_1487AFBB X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;