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: 9337129 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 A51B360839 for ; Sat, 17 Sep 2016 15:09:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95CEA28BBC for ; Sat, 17 Sep 2016 15:09:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A67E28BC0; Sat, 17 Sep 2016 15:09:31 +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 0289228BBC for ; Sat, 17 Sep 2016 15:09:30 +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 1blHE0-000147-Ls; Sat, 17 Sep 2016 15:08:16 +0000 Received: from mout.web.de ([212.227.17.11]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1blHDw-00010H-CE for linux-arm-kernel@lists.infradead.org; Sat, 17 Sep 2016 15:08:13 +0000 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> 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160917_080812_809808_7B48479C X-CRM114-Status: UNSURE ( 9.36 ) 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: 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;