From patchwork Wed Sep 14 18:40:20 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: 9332255 X-Patchwork-Delegate: sboyd@codeaurora.org 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 03D376077A for ; Wed, 14 Sep 2016 18:40:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2C542A27C for ; Wed, 14 Sep 2016 18:40:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3BC52A27E; Wed, 14 Sep 2016 18:40:40 +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 6BC0F2A27C for ; Wed, 14 Sep 2016 18:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757910AbcINSkj (ORCPT ); Wed, 14 Sep 2016 14:40:39 -0400 Received: from mout.web.de ([212.227.17.12]:52383 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753866AbcINSki (ORCPT ); Wed, 14 Sep 2016 14:40:38 -0400 Received: from [192.168.1.3] ([78.48.193.118]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LuuFh-1b1w1e1DFJ-0103WG; Wed, 14 Sep 2016 20:40:23 +0200 To: bcm-kernel-feedback-list@broadcom.com, linux-clk@vger.kernel.org, Alex Elder , Florian Fainelli , Matt Porter , Michael Turquette , Ray Jui , Scott Branden , Stephen Boyd , Vaishali Thakkar From: SF Markus Elfring Subject: [PATCH] clk-kona-setup: Use kmalloc_array() in parent_process() Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Message-ID: <1fb2e894-93d3-3dbe-ca05-7e29e4c60e2a@users.sourceforge.net> Date: Wed, 14 Sep 2016 20:40:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:hjdTryDW7lguEhSrfuoSHLXUljHjb2h91iIHJQi5KOXYqzp8Vaa 4WaFEA//fhpOnbH0wQK47ZkRrgU9TfFRdJcsmpzQ9zrBX4TM1KRmkSszYY+YLkNOsq8uhMN CYU7r7QMrAwsXDp8lcJMbN8LoypWssBUZAUsOXOBlzCV0ZSdJex2aS2TTLB0RKbvPaBrZdR BcDBzdQK7g4qt2iKab9yw== X-UI-Out-Filterresults: notjunk:1; V01:K0:BTOx9oQ4aZs=:67PEgyIcie+To/WrpmN3d1 92rmRshsf1+2MUkRnjPXanX0F/gNd4zqOZ/eWZSG8JfjwPO650gP6GWBYEULB0I20kIyuWWmx UJrfOOX9tO5NnCfzj/C0bMdk0L0t1Jz48ROFKtEXKuta99znOzkem6yLwbr8H/GCo8hDRvHSr LLzMSOcQcQGwnuFGmMWWMYfdALtlimcGITtrajLLwZtE5sK9XXHti8LqWw7ORCBQjghSn3O5g FhjafPNKHMo8aU3KhiYHYx22oenxkMNodXxfgu4o1Wx4Mx/hjnX9K1XNLfX3hkPYyHuTTasJq PSvRbGFaEqlIK98tzItINw9vIYKFdOLYkU8YuDj1guOpZM+7ePmNIrP/msf0rq6yjq4xq64g4 +WJjiUkruWDpMDNYbB1+uCUJk+AE2i57j5Y7n/FhrjyMSD+V1foLwg5hdah32bPRbefHCv9TQ MmVZQa4gIQGK76vZRLVqIPlQENxG7Fwh8GEeQdsi2YyPaJKQD/ietZY+ESKBKDHOYK58mA+K9 UTcmORBRE4hM6XRHsrA7p3/XHt1TsdaycT3+3dU2c9uAjaqM8CRYwlkT3JevEzMaktFOWjsLd Nd+2WJfnvWEYZyq+/H2YZj5hyV7L4rno96KFZMPpApQJLJLChXRvq2jj66sUoeOK0BIqn5tHz REdpa4O54d5YyPiOX8guWRWhY0joJXSK/R6/SoQa2+aYvs2y4a886CT2wRhPftcc6WR41g+/5 TuTFq7igPdyTkWnlcJvrFokmCueyzgfSwExHnvToPUi2hN/ZXkelGEVPtmjq9LSjJwpLrR2Ww x5hBfBK Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 14 Sep 2016 20:26:05 +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. Signed-off-by: Markus Elfring Reviewed-by: Alex Elder --- drivers/clk/bcm/clk-kona-setup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/clk/bcm/clk-kona-setup.c b/drivers/clk/bcm/clk-kona-setup.c index 526b0b0..a2e7e91 100644 --- a/drivers/clk/bcm/clk-kona-setup.c +++ b/drivers/clk/bcm/clk-kona-setup.c @@ -586,8 +586,9 @@ static u32 *parent_process(const char *clocks[], } /* There is at least one parent, so allocate a selector array */ - - parent_sel = kmalloc(parent_count * sizeof(*parent_sel), GFP_KERNEL); + parent_sel = kmalloc_array(parent_count, + sizeof(*parent_sel), + GFP_KERNEL); if (!parent_sel) { pr_err("%s: error allocating %u parent selectors\n", __func__, parent_count);