From patchwork Fri Apr 14 09:20:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 750780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3w4Bwv5Y60z9s73 for ; Fri, 14 Apr 2017 19:21:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753085AbdDNJVM (ORCPT ); Fri, 14 Apr 2017 05:21:12 -0400 Received: from mout.web.de ([212.227.15.4]:59114 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbdDNJVK (ORCPT ); Fri, 14 Apr 2017 05:21:10 -0400 Received: from [192.168.1.2] ([77.182.208.89]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MNc1S-1cxIiB1nQI-007F0p; Fri, 14 Apr 2017 11:20:57 +0200 Subject: [PATCH 08/10] pinctrl: imx1-core: Use kmalloc_array() in imx_dt_node_to_map() From: SF Markus Elfring To: linux-gpio@vger.kernel.org, Arnd Bergmann , Gary Bisson , Laxman Dewangan , Linus Walleij , Paul Gortmaker , Peng Fan , Shawn Guo , Vladimir Zapolskiy References: <59fae4ac-9e07-232a-4843-92dd9e0cf2ef@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org Message-ID: <7e8a5c9c-aa4c-0675-3690-dfe1fed56915@users.sourceforge.net> Date: Fri, 14 Apr 2017 11:20:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <59fae4ac-9e07-232a-4843-92dd9e0cf2ef@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:QlxrN9fvZjREXGGwrN9u0WDA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: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Markus Elfring Date: Thu, 13 Apr 2017 16:10:33 +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 structure 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/pinctrl/freescale/pinctrl-imx1-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c index a4e9f430d452..5a0d221ed09d 100644 --- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c +++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c @@ -246,7 +246,7 @@ static int imx1_dt_node_to_map(struct pinctrl_dev *pctldev, for (i = 0; i < grp->npins; i++) map_num++; - new_map = kmalloc(sizeof(struct pinctrl_map) * map_num, GFP_KERNEL); + new_map = kmalloc_array(map_num, sizeof(*new_map), GFP_KERNEL); if (!new_map) return -ENOMEM;