From patchwork Wed Sep 21 07:25:51 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: 9342959 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 33B346077A for ; Wed, 21 Sep 2016 07:26:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EF2B29F6A for ; Wed, 21 Sep 2016 07:26:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1358229FCF; Wed, 21 Sep 2016 07:26:18 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 91E9629F6A for ; Wed, 21 Sep 2016 07:26:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8DD8B6E7AC; Wed, 21 Sep 2016 07:26:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB5C46E7AC for ; Wed, 21 Sep 2016 07:26:03 +0000 (UTC) Received: from [192.168.1.2] ([77.182.212.253]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0MUWCB-1bLyLE2VjH-00RKfl; Wed, 21 Sep 2016 09:25:51 +0200 Subject: [PATCH 2/5] GPU-DRM-nouveau: Use kmalloc_array() in gt215_link_train() To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, Ben Skeggs , David Airlie , Martin Peres , Roy Spliet References: <5bcff2ec-f3bd-ab9c-e13d-3a4f5cf7c73b@users.sourceforge.net> From: SF Markus Elfring Message-ID: <6fcf1d5f-73eb-9107-dc1f-be03a5fef271@users.sourceforge.net> Date: Wed, 21 Sep 2016 09:25:51 +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: <5bcff2ec-f3bd-ab9c-e13d-3a4f5cf7c73b@users.sourceforge.net> X-Provags-ID: V03:K0:3zsgZTdXX68oYGMT12hgj3E+EBC/jpRKxgjrJ2+KAaaTED5Aexv sTwaczYN1OG2gTBD7Ivj/ErXT26gMr43vn/WSScJpH6YKzFwU1uWVG+013QCzadgWx1dya2 lJd4EfnF/s9mUwctoqFOrCcjm2mljiDfFrta8zOE/XwLbNklZUvxVvaC0TyjJ0wOpdZ/X8M +hh/NeuqxPgLAFrNJFzKA== X-UI-Out-Filterresults: notjunk:1; V01:K0:AxuvktGu2Is=:k4Cln1REic5X2t6+RVFRZ6 a/VJbIJQt2+uVk/a07vYKyWTmlq0DGs44RlgY5LmJNwTSdqYEp9vTre0nrxQE/PI9Ufm5HLpE k3D/5UQSw2rUh3LJ2hDknJmlUznv6DQYTCEnhAb6Vbu6Q3kJZQZk6PqXE2RuVu/MR3MtiXg7t MfhV/EfNwyN6NyzkY1V+gOh92r0sFfvxvGSE1CpQCP1d6f4NfgzVdSJrBsDMBXk5wGnaa4yyt 8wRliIXf35tpnKZTALNccHK8j/ODN5XBIP6pD2ywG4Erg+r93OKBfDsoxJtYldOLXoLZCtXk2 VOOAHgVelMzKzl4fxLxfqfh+6HDCuuzXdsDV/njfMbpXrYlFoaEelJ9DIfbQr/6KDh2aN7znG Ycgen2TdWDc9RgrXx5Ktvz208yM3w0GmkWJdU4kfxpZ9iONTB/Ju8LLipA4qiTfVMQlDtZO67 emfwSp6bh+rrnNDbFXmkRyefKr86DbU91GX5u3S/0siOud/9Rvi6i7Ui9GMyGpbKnqvASGGQu HLMlxTd3cDueG8bIt+DZUtsqLdrjUZ6RIsC1DCluD9SDQEpcuGX4EJ//xHXqx5/Co7TPbjGaa dyGfVktiJngoqa4fMd9ieo0qOc/vSSxsYE9dKbvZn7nZ1t2hWBN86UA3pZq+HZWuA7A4kAbKx ytp5g+MzDyWNVhjuWt5Xxn42YpyRbSSHA8s9DrXWl4ZDDNSur8VdCSPcxxIe6WZ2TVg6xqLv0 +AaTY3Zj4KmdW25jmtD8jm/5Cwd9B6GOeFoVo2uBpvMqg527HxcXP1HCfa7f+JhAvh5y2bKzm b+F1E1v Cc: trivial@kernel.org, kernel-janitors@vger.kernel.org, LKML , Julia Lawall X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Tue, 20 Sep 2016 22:32:14 +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 --- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c index d15ea88..dbaf577 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c @@ -170,7 +170,7 @@ gt215_link_train(struct gt215_ram *ram) return -ENOSYS; /* XXX: Multiple partitions? */ - result = kmalloc(64 * sizeof(u32), GFP_KERNEL); + result = kmalloc_array(64, sizeof(*result), GFP_KERNEL); if (!result) return -ENOMEM;