From patchwork Thu Sep 22 08:31:47 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: 9345447 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 73C9660757 for ; Thu, 22 Sep 2016 14:53:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 653F02AB4B for ; Thu, 22 Sep 2016 14:53:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 599192AB8E; Thu, 22 Sep 2016 14:53:36 +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 ED00B2AB4B for ; Thu, 22 Sep 2016 14:53:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A7FF6E73A; Thu, 22 Sep 2016 14:53:35 +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.17.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0DF436E73B for ; Thu, 22 Sep 2016 14:53:32 +0000 (UTC) Received: from [192.168.1.2] ([77.182.99.72]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MPHKO-1brN8H3lA0-004Tdw; Thu, 22 Sep 2016 10:31:50 +0200 Subject: [PATCH 1/4] GPU-DRM-TILCDC: Use kmalloc_array() in kfree_table_init() To: dri-devel@lists.freedesktop.org, David Airlie , Jyri Sarha , Tomi Valkeinen References: <566ABCD9.1060404@users.sourceforge.net> <2f3f7ad7-16a0-1dfb-d073-0d993cd767ee@users.sourceforge.net> From: SF Markus Elfring Message-ID: <7c0f291e-e05b-1fbe-05a4-54c104829942@users.sourceforge.net> Date: Thu, 22 Sep 2016 10:31:47 +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: <2f3f7ad7-16a0-1dfb-d073-0d993cd767ee@users.sourceforge.net> X-Provags-ID: V03:K0:2K+32UQml9hkfr4ovw3kWcXJqk+eYgdli3SVbYUaPDZ0Xf/9d9p ZBTx2wQzAs/SBDzpt08onlAOwhfaObUgGgkvN6XfvxflOdiXbtDPxTPMQoBTNGTK2mKONWt E5GC4aRXryfVzeKzBjQeSWrTy8D4zvpH3tWUR3MlLf5fRAYtXMmQegt9ZR2dWK+/e9q/IBX NaOJ3KOWPqYUE6txsFVLA== X-UI-Out-Filterresults: notjunk:1; V01:K0:TeGCduPGx18=:AZgAdsyVRyZwXxH7NeKxfP KBLynItv/9h8yBgumISoDKZ/mzpp9hRQP0h+7gR15RAPwqj8b+/mOReYl0LAPWMMNVd6cmYlk td0dPWh9A/WFXcJfGEMRVh49blUKytrUzw4D0gqCdqUo/ExbRkeujTW2dQoLKwwnoscUZtAtO ZDH3R4P/goZnPUr8+zgXgd/hQKgwIg6tTTz4ujiEzj7tvGz3HNA/iHDFVs8nVSX9d+YPFc57D tuki9KwBpYD6t+aStz8S8dgKvL1RPu9UAbzPmQM/dVskaAecDUE5TOpsVv6TZ6QPK8d8nENAc giWVAa2dj4UPZK4guHpODMWZXXrPVnG57smxackcx1Cj8RLvgO7/xIm+JfefiyT8A8/VmP3g6 Mg0iISfLmvGFtXfXCwtyn+lUOVW3nium5/QP6hsmkPZSc9kyO46vyPKBSfq+BOGZLEr7M8ZWu UMT7TBR5N4OFlEHH1labJA3eXM2+5F13UvZSA33USpE/Jl9GQxrzlUu7N++fgG6Mb7qsbL4v3 4M2JuWlqqC65yoDrCKU82EARkopivWD8v6/xkHlDQngA3h+pRs5fvhT5XYPPO+AoTAOs9CAnZ qQPv7QFUC8DbqnHz5ALlfXz/wYfUS2FwGqjMtmZD08/fHlgsCzChoEgkdRaY17q8B/v+awF8g 3gMNr+1Ugh5BwW4Gr4gyVj9CNrZ71m7ntrVTuOJQwbOzTCaeseaqmIU1Jp/rxt2BKUDZQnJ/I 64/N8Ttn7dfJMqUEdb7zOo+miosgj2ZX19WEV900SToTOxGg45QlBAQvtP1zeZG44uts9EQtX XSl0Xfm Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML 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: Thu, 22 Sep 2016 09:05: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. Signed-off-by: Markus Elfring --- drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c b/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c index f9c79da..8faa28f 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_slave_compat.c @@ -32,8 +32,7 @@ static int __init kfree_table_init(struct kfree_table *kft) { kft->total = 32; kft->num = 0; - kft->table = kmalloc(kft->total * sizeof(*kft->table), - GFP_KERNEL); + kft->table = kmalloc_array(kft->total, sizeof(*kft->table), GFP_KERNEL); if (!kft->table) return -ENOMEM;