From patchwork Sat Sep 17 15:07:30 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: 9337121 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 9DB5760839 for ; Sat, 17 Sep 2016 15:08:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E4BD28BBC for ; Sat, 17 Sep 2016 15:08:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8227628BC0; Sat, 17 Sep 2016 15:08:18 +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 2A08328BBC for ; Sat, 17 Sep 2016 15:08:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752030AbcIQPIR (ORCPT ); Sat, 17 Sep 2016 11:08:17 -0400 Received: from mout.web.de ([212.227.17.11]:50356 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751970AbcIQPIQ (ORCPT ); Sat, 17 Sep 2016 11:08:16 -0400 Received: from [192.168.1.2] ([78.48.101.40]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M5wrF-1aneNS09FJ-00xpYa; Sat, 17 Sep 2016 17:07:43 +0200 Subject: [PATCH 01/24] ste_dma40: Use kmalloc_array() in d40_lcla_allocate() 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:07:30 +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:2huwQioir4NvGfhur7To9pC3sgIIZBlpMWpUfvByuIdBWFx3spM Kw8RRswsAg/XzkaLxXMRlKNT0s2ygWIwHNnYzaRtVmQos8Q6A484DaZB6Q1lLY8ENKxFPNk PMuwykFUt+/TiifnP5mh0kV7zu7FujgtkseTw90SRDsFHS3ErjosYZynYWUp/47TBVGkHOE npYYzYfaxgKAD98tsE5Qw== X-UI-Out-Filterresults: notjunk:1; V01:K0:oUq5+aRtwVQ=:52ZI6j5PuUUWBp2TFaOJp/ km+XjS6LXtePd9PtJuqY+qWEODj56zU/311poof5AGvawtCD+V2ms2W0ob41OZknzpiZgiUHD qJJxCR6pulI1mCFlOJeFdoYF1WIshG6drFvXygzqj1bbXJWDsxhGA15swSlRKiaDcyzS77N4Y 378XkIiN2eSUu6Kxjt8HmTU5MEw7sSbqfgX7NUFtYaXgB6HkJhY4F92lOZr9c4BjKhf8HEu74 6/SHvKDcMJbT7wKmTkngSP37qhNnigqbc9/cE6bVPDW++aCpP2Fp9ms+kWXLbE9E9spNPLFLD yio6U6pPzJ/BznYxbSrsqTOO4U0/FoPat1eXvQdiQsMvNf2aKI43bSyhgCOmOoKtsD4/PAgHp 63UNDVbPlzwPFtRSg+g32deQW8X8ioQDHO25sRIecqhfaGI2kvhX6wqXFL92BOxAdrw8UCyMr dPgve/CB4VGHAjqqUKo245dFa6p7w8R+kM5MBtDzrPgYOoHVKQUhVok9H9n51WBeMRIe1NQKH MoCkCCjqz6BmCkaggAmpDatm+iTM0BhT5ZuuzTNhAXpjGXYNbcxfn6y3jnMi93Mf31Mt8ZDDM MpRRh2i1FJOPwsOQ49odXmxeFL1oUkQvDAxUUkGnVsEE6zdPg215BRa7Eb1vLvUDd2i/7C3k/ TN8eMeXXDvpHXDzEb8C/KL9RkYSILGnGp2zvbNyYndl601yrED0RPXRT9cpM9Ik8VSHCSz77q 1zbm6ds8IF2nFBtTLv1Ak/JSaE1Aa2o0CzKb7WiiQM07/oPnxFydyioDZdUIgwL4I2PBlHMx2 FH5Dyzd 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: Fri, 16 Sep 2016 17:56:07 +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 by using the Coccinelle software. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. 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 73203ac..fbebeff 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -3409,9 +3409,9 @@ static int __init d40_lcla_allocate(struct d40_base *base) * To full fill this hardware requirement without wasting 256 kb * we allocate pages until we get an aligned one. */ - page_list = kmalloc(sizeof(unsigned long) * MAX_LCLA_ALLOC_ATTEMPTS, - GFP_KERNEL); - + page_list = kmalloc_array(MAX_LCLA_ALLOC_ATTEMPTS, + sizeof(*page_list), + GFP_KERNEL); if (!page_list) { ret = -ENOMEM; goto failure;