From patchwork Wed Sep 14 20:00:06 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: 9332357 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 7B898607FD for ; Wed, 14 Sep 2016 20:00:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68EAA2A1BB for ; Wed, 14 Sep 2016 20:00:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ADD02A239; Wed, 14 Sep 2016 20:00:44 +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 EBC902A1BB for ; Wed, 14 Sep 2016 20:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764107AbcINUAn (ORCPT ); Wed, 14 Sep 2016 16:00:43 -0400 Received: from mout.web.de ([217.72.192.78]:51709 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763863AbcINUAm (ORCPT ); Wed, 14 Sep 2016 16:00:42 -0400 Received: from [192.168.1.3] ([78.48.193.118]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LfRnJ-1bCpQ416JF-00p8C8; Wed, 14 Sep 2016 22:00:21 +0200 Subject: [PATCH 1/4] clk/Renesas-MSTP: Use kmalloc_array() in cpg_mstp_clocks_init() To: linux-clk@vger.kernel.org, Geert Uytterhoeven , Laurent Pinchart , Michael Turquette , Simon Horman , Stephen Boyd , Ulf Hansson References: <566ABCD9.1060404@users.sourceforge.net> <1575ddf1-bd1a-fe98-046a-a586eb30fe47@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <2f96a36e-fae9-5992-7259-67c92692bbc3@users.sourceforge.net> Date: Wed, 14 Sep 2016 22:00:06 +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: <1575ddf1-bd1a-fe98-046a-a586eb30fe47@users.sourceforge.net> X-Provags-ID: V03:K0:12sWmpRBtSqGk+BtplOVjKND7ECLogq+70UR3/aLJX0yqYN+ots TNu2+wjopuenBL7UMQ/tpzf3rptDoxv6C0Z5phJtgrnyKIlxJarKWhYNM21GkCoEKq9OLGb 90f+tnyL9h5H/Yw9P0HHoBnrLJy0sg3xGv8+mWiTOSO8Z3wimz/SV/1EfUQmmIWLipIRX+5 mz9CfYVT2c8ECVSYa1oow== X-UI-Out-Filterresults: notjunk:1; V01:K0:cQwpmBJtxkE=:TAauBmebvWl4MrvLt3ooo0 zttc3SxpekT1TZdgK8q2jraA4FdfuU7IxeHs9JiND/ubhEtXszq0c06bXEeUyoOQ0tfQF8km5 06TVr6+kTxqW/89ADCe4F7ymfcSKWWSSlsZUcDJ3NjANKsrde0ZrfpwIZgtALILMulg3r2ivr gwZCmqW8Fx15p/h2NhOqeQWZDlkiuFhHgae5MYlxKs6Q/fPn9+c98UJlLMuN2c/trK/CLhTGy /H41FJiP2BqKtrhDbL9bOBa5KHPlrthdRcOpxJNsXRH1Kbs2p7ob8MGM2J2vxN+/M4/s6yNOu n5oYUziieItMw5QXhABcgzBBrcEUNv1jMNAWzIainLTxBjmSd62YUTIv7QUCQrj0A+wHTW0fZ YI4D0WTUwzHQrqraxTCL7G5nyEc4RHbEmxK0dq3+424+HSputC/AFb81NuFaeJ3V3M8i2P4N6 vmCR671oveGrdhBJnFJwzM6xrOkk3dgkGnL6FiHO8OLooMVxYE3pgu6UT+xmYdgXXLSHLE/3x Tex6ilo+/VDqm18+2SHSiWX9A8H1MkqR9SmJSZ7iUDc7pBuXZcdNDMaOO/B6FFJQ+29kc0Wow 8o1UUec7PoBQ+A+qxAwC1+xYrtcrtRGKEfM2A6fC34zSqYsp4e4anbb3IRAtWvzLWebo5/L5u kuN3GW290/wevEC7w/vH78Ua+rQXTII1c6qsQt5lGmN2w+hMKOLEShKi3CCjttLR9im33nLBE xjBbLXkt9Zmsuv0El1mpxFKlvS+S6Z7VZjJI5y5q1YDhkupzWDvtZvJVDFxH0FBp5iur7eOsE XppXnQO 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 21:10:47 +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: Geert Uytterhoeven --- drivers/clk/renesas/clk-mstp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c index 5093a25..9375777 100644 --- a/drivers/clk/renesas/clk-mstp.c +++ b/drivers/clk/renesas/clk-mstp.c @@ -167,7 +167,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np) unsigned int i; group = kzalloc(sizeof(*group), GFP_KERNEL); - clks = kmalloc(MSTP_MAX_CLOCKS * sizeof(*clks), GFP_KERNEL); + clks = kmalloc_array(MSTP_MAX_CLOCKS, sizeof(*clks), GFP_KERNEL); if (group == NULL || clks == NULL) { kfree(group); kfree(clks);