From patchwork Mon Aug 29 11:10:05 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: 663590 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sN8BN1LY5z9s9c for ; Mon, 29 Aug 2016 21:12:28 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sN8BN0YNLzDsPN for ; Mon, 29 Aug 2016 21:12:28 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mout.web.de (mout.web.de [212.227.15.4]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sN88S6VCXzDrnL for ; Mon, 29 Aug 2016 21:10:48 +1000 (AEST) Received: from [192.168.1.3] ([77.182.223.245]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MZAp2-1bNtWl0zxE-00KyGc; Mon, 29 Aug 2016 13:10:07 +0200 Subject: [PATCH 3/5] powerpc-MSI-HSTA: Use kmalloc_array() in hsta_msi_probe() To: linuxppc-dev@lists.ozlabs.org, Adam Buchbinder , Andrew Donnellan , Benjamin Herrenschmidt , Marc Zyngier , Michael Ellerman , Paul Mackerras , Scott Wood , Sudeep Holla , Thomas Gleixner References: <566ABCD9.1060404@users.sourceforge.net> From: SF Markus Elfring Message-ID: <0c2c17e0-aed2-4b66-371d-fada59cd0861@users.sourceforge.net> Date: Mon, 29 Aug 2016 13:10:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:BZqsqDBislzHK+cwgfxI2U2558S7X/1Z8gX7Znu0FRScVI36W0i 90vPDTUeTrMmjlVHPl7YROKC5kCsC8zDlzoE+VGtHvZVQ7SRvJEt5NZByU+rnLp3PDztGfm psElUAp+6xhaxHnlmbAX87Ic80OJPcSdMoauK17wvvyroX7uMHcgALYoisM33jNyXE7EO2K PI0TFPga11uPUe3TBb++Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:AHmLtxiuHBs=:kxLuxCzk7MQSdCvxaQFecZ QjgzNnwsZQIJq5rWaKh+XKLr/42xM4tvCDOHa6uzOgOsy43Rzl6htGato+Fd7xF9lTVNbE3L8 P+ZInmKwXlq7wJSWZXSwJfhzKnrqOluDVo9otQMa8SKXAxdMHsx9/3wlukm45l9vUeJTuXUfP AdxpA3rxZfsSsq/ZAeIaucowyvflni+sLY/avIe7IggwltFeZPcy0MgaENot5EcL4lpsSz9d8 K8Rf/vxf/flMvcZFbSyzU5YgL0wCBaLGPrr+UwUGi9UaexKzdrqLlgGqumuIbg69TbXRLsD8x aD/HhfHpcrKhBSP62AqV+LlYtoOnRjAnXYBUFDHoTj1NYYoJXi+vtDkKVJlrEuNwR3ObnCmk6 aKA/huL9fZXYAZ/G7+IizU3U6nN9J786q6s3bu004HRTuRtkhPV6fXpnO6gpbr52ZF93e6cNv +Xymu2d9Lq6Vf1R+1gKHJ6ekB76xt7q8pBweO4tOgel4ZkBWupeYRR0ZmaTbmGQ1RM5vxsnkI xOeBrbNufFgtrqVoylUnM0rDV1ePc2VkkrVv4FmteCVwgK2TzOjtQoXBa0rwJcqo4nXJd4ge2 NyCBMVHvEu5Qw9G1UOVpm1GiBT0bI3B5uiwFWuolQ6IwXZrlpqcI93dujpFvofIrmBcamlOhD 8BWYV7Rmz2BHVdmctNKtVK1wQLFeGpGHnPTau7gl7npkxTgB3Xe6+Jy7ohECobdW4P4WBLpmm fP1sA4AGXZ0YJSoc8m22aHStvOtX8aNr5v5LvVmObLpd6rwCFWnnA9YMF9ofjLSRHKhLv1Oq6 U/Cyl44 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML , Paolo Bonzini Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Markus Elfring Date: Mon, 29 Aug 2016 11:20:39 +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 --- arch/powerpc/sysdev/ppc4xx_hsta_msi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c index 52a93dc..691db9a 100644 --- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c +++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c @@ -156,7 +156,9 @@ static int hsta_msi_probe(struct platform_device *pdev) if (ret) goto out; - ppc4xx_hsta_msi.irq_map = kmalloc(sizeof(int) * irq_count, GFP_KERNEL); + ppc4xx_hsta_msi.irq_map = kmalloc_array(irq_count, + sizeof(*ppc4xx_hsta_msi.irq_map), + GFP_KERNEL); if (!ppc4xx_hsta_msi.irq_map) { ret = -ENOMEM; goto out1;