From patchwork Wed Sep 21 16:52: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: 9343919 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 62AF16077A for ; Wed, 21 Sep 2016 16:52:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 647F62A7F7 for ; Wed, 21 Sep 2016 16:52:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 592D62A7FB; Wed, 21 Sep 2016 16:52:20 +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 EF0952A7F7 for ; Wed, 21 Sep 2016 16:52:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 41FBB6E875; Wed, 21 Sep 2016 16:52:19 +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.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6FF556E875 for ; Wed, 21 Sep 2016 16:52:17 +0000 (UTC) Received: from [192.168.1.2] ([77.182.212.253]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0Lba35-1b6UyS3xv9-00lHN7; Wed, 21 Sep 2016 18:52:08 +0200 Subject: [PATCH 10/14] GPU-DRM-OMAP: Use kmalloc_array() in omap_gem_attach_pages() To: dri-devel@lists.freedesktop.org, David Airlie , Laurent Pinchart , Tomi Valkeinen References: <566ABCD9.1060404@users.sourceforge.net> <0ea38611-3d93-0ade-a1fb-f8cc2e0b8d61@users.sourceforge.net> From: SF Markus Elfring Message-ID: <2e7b2e16-c448-3470-32d1-582db3aa6634@users.sourceforge.net> Date: Wed, 21 Sep 2016 18:52:05 +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: <0ea38611-3d93-0ade-a1fb-f8cc2e0b8d61@users.sourceforge.net> X-Provags-ID: V03:K0:TBCyqw5aiD0+/J/pA7c5fB5C6wytlO3WysUxvTMRsgIktR1qovs SqNEndNc/NVWz2lGo1xhH80JIzFNXtuEICpSrZCv81ZvIvT6T8eBUpETPD6GC5bmLS9ueQF IQ2NNhScHvZ6tXcFEOZas0VBKsnPwxqqaXcYMmjqqiwZSzdX2g7V+WjVtx3exSdfktrBgDQ Mk1vrw5SVo16PwzqDiK3Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:BrHps2AnSsA=:IyNH/wyDti7t21P7PtP/OL 4+3PAV8ZKXXAsqWTL4Ts0ENkJouqeJUAPCFUf4YgTNvarbU7od/UjudLcyrUHNQW59MrwjySF Y9vAub9Wb02q/LDwT5R2yX68sPh5GYizBcExnOyPRm/S/38J/0pqKVh8aMZt3FmhlihQ+4UOL 4cC/C+CcekUaSIFDqob5fd+fAiNmANDoh/IDypFzQ32zpgYaDRqZ2Ex6Htjcu27EtmXHnEwRP X7+3x1liOOgHRGNA0VFzbRa+HkyiRJSQX4zNnwuQaMRmtVHAk5q5XV9SH+NuLj47GzxXfB8oz YQZP3aK/VOXFO3SfrND3W22cwR7vFlMoUviJ3yF2lb5iXDVKwOvr+poojI4rilHGVtKuLy52T wSzThZ6m19um4Yj1tZ67dWsJg7VmtMIrAQ+tnFkf7QckR2JNNorCI/SFCygvm18d06lHUghAh PALMbe/gqsmdyER13TL8Laxac6wXzVLAj9fgtdaewebM8VQ1HSvZN4dpK1XNalUYZTDOYgBCJ OSRKjA+QrBc92+//88nS7qVezlzCmCj10Q2V/aAcV4o9pxrmwoVDz0RLMUvhSV/QYDb2QaYyi j849p//JLVuKV2Iq0NTX0we9+LdjEMYtWty2JSkxpfUD/YO3/dMoI53aMU0vrrKvCjANcJqA4 AMOY+tWQpU/oquzvVdDyu7hQlTDyK7fCn2Oi8XiGbPI5BZHJF9q2dxks/U4De1QgbXdOz0udj 9YrPyJ2X9egx7ns5Qi3x32ulV5DYSAAMShnzzyzDgp+/fb/8BXiRk8USfAeCH4Alhofs9/0y4 vHvtGcZ 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: Wed, 21 Sep 2016 17:37:04 +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/omapdrm/omap_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 505dee0..e4f1924 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -259,7 +259,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) * DSS, GPU, etc. are not cache coherent: */ if (omap_obj->flags & (OMAP_BO_WC|OMAP_BO_UNCACHED)) { - addrs = kmalloc(npages * sizeof(*addrs), GFP_KERNEL); + addrs = kmalloc_array(npages, sizeof(*addrs), GFP_KERNEL); if (!addrs) { ret = -ENOMEM; goto free_pages;