From patchwork Fri Jan 13 17:12:23 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: 9516041 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 B0E9960761 for ; Fri, 13 Jan 2017 17:12:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E2F428761 for ; Fri, 13 Jan 2017 17:12:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 930BE28765; Fri, 13 Jan 2017 17:12:41 +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 52CA628761 for ; Fri, 13 Jan 2017 17:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750944AbdAMRMb (ORCPT ); Fri, 13 Jan 2017 12:12:31 -0500 Received: from mout.web.de ([212.227.17.11]:55861 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750843AbdAMRMa (ORCPT ); Fri, 13 Jan 2017 12:12:30 -0500 Received: from [192.168.1.2] ([78.49.203.248]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MA5if-1cGq373RSD-00BL7M; Fri, 13 Jan 2017 18:12:24 +0100 Subject: [PATCH 04/17] spi: fsl: Use kmalloc_array() in of_fsl_spi_get_chipselects() To: linux-spi@vger.kernel.org, Mark Brown References: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <2abbbc08-f5bf-28de-e513-5f1074996189@users.sourceforge.net> Date: Fri, 13 Jan 2017 18:12:23 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1413e173-dbac-7a6e-09cb-2287300a335e@users.sourceforge.net> X-Provags-ID: V03:K0:LiVMJaKcKF7cHtw0CSKSewGA41jC3KV6Yq9xC597g9RqMd+A/wx uIfyWZ2qBJkLN6KzzFqnsqkkLdwwKH2ig54+CjyqYWvkBgECc3gpkBDC7hvHCWGtmmBP9xe nVqC1nxQ/mzxQ1DUpCTUu0vtCzqBJ4kjIpV1Dltz/+45nljMynMwfggvys2CIKGatotOGR3 IMFRSbzTL3pY/R1qfXTUQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:gbPa9d89lQ4=:1sH2Q1T0KEtmXdGFvJz3ZR /UqePibPH5hHRmrfk0v/Uq2p2UhcWt5zT8WK9engkE2oGdBJc8OKrF4GPEh+h426f28Sjabx8 SCt48JK1/TpaCjoLXQMw1B8ZmrE51Q2Go38sDkSef2HRAhCD3GTYkUtUyj+vESI6ClTR/WXEy ejDyYX/bjUCegXknbNAmn1zv52jS07xH8uMMlwbg0GMWute+Gb1R+QB2UL9+C2CYBab63l2jg k8f+DZK27TiMTCxrXu93VuZKhbK0RZ06Q6NBS5uzoNdpFqPFblsfIV0QuWCC0F7m4y0v0w/h7 ZtK81DhgQnChEd7e+AuGFhSV1xg1aAEUgBBW9g8UdFGgKrQCyC4wv/FdAG1Lrxq5sv/8QZkgz Iq2FB7mGRCtr9OBH5A1UJsS2HwM/Kj2eVpvmQUiDu4UY6xPRrivpDStLi+4F3kjmz3sAqiHD3 JGUjrged1Sv4I4U5ToV5wij/KKZqB34EKfCxnwkSeWcjZ5wjzZ7uSQX00YnSvyXEpoX7vkUSS FlNZihdpUcDK1ruBWQHv8/eO3gg7hQZcqPaacCofuin3sdoOSZYUr7Q+yvXM5pO6IZ0nBCX6D YwHQp17nmRzYAkJz7Uwid2XjHUz/Rl3X33sILmTe1E6fyq3DFUypNUencFdRuDsKLDEjythF2 uzA8wX+ML4rfGWAEXNLzx6Fghn+5Di3mx3JyvRiZVguxt8am5thbzXoutS1QyxuEUeED1xABY fPDB02TvAmQNsoP4HBlgIyo4F2c863oMoL/sc8SFvTzbHrpxCVtCW66iMqAgOmZbDfO1GoIti 9qVgYt2 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 13 Jan 2017 13:37:25 +0100 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 --- drivers/spi/spi-fsl-spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index d1b26c9fe950..cdee556037f9 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -727,7 +727,8 @@ static int of_fsl_spi_get_chipselects(struct device *dev) return 0; } - pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL); + pinfo->gpios = kmalloc_array(ngpios, sizeof(*pinfo->gpios), + GFP_KERNEL); if (!pinfo->gpios) return -ENOMEM; memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));