From patchwork Wed Sep 21 16:38:12 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: 9343869 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 06AE06077A for ; Wed, 21 Sep 2016 16:38:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0311D2A7F0 for ; Wed, 21 Sep 2016 16:38:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBC182A7F6; Wed, 21 Sep 2016 16:38:35 +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 580592A7F0 for ; Wed, 21 Sep 2016 16:38:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03DC96E86C; Wed, 21 Sep 2016 16:38:33 +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.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3FFAD6E86C for ; Wed, 21 Sep 2016 16:38:31 +0000 (UTC) Received: from [192.168.1.2] ([77.182.212.253]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0M9Xfb-1bgwQy33wl-00Cw8Z; Wed, 21 Sep 2016 18:38:23 +0200 Subject: [PATCH 01/14] GPU-DRM-OMAP: Use kmalloc_array() in tiler_map_show() 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: <1e833599-303e-0ff0-30c8-7b7ee08f8b4f@users.sourceforge.net> Date: Wed, 21 Sep 2016 18:38:12 +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:UTdSdZ+KrVSaIm6ruoUfwcabOYxytF8VHHjOPQO6DxWMKZSBWrf +V1wA47Kq297Mz41E7e7eU5hbOpFRYHp+i1rikIp2ItyeuO7ODUdCCEnnxj8UMUEiyTXGRL Kn4ExmywaYgNahNgGoG8XWtiKU5ogBqwlBbnjcn/bjChYqh8Igh6fNAOe6MNiUB1xELrRdQ mHXxa3SqAsO5PYmQSR9Iw== X-UI-Out-Filterresults: notjunk:1; V01:K0:cY4rJ0vD4n4=:i5e+q41HEbpsrMJJATGYGV AgQd/VaMLmb7b44CHVf3ZJRET+AcvwoXTXZSpwQAkbQewDc96OiA2/JuG88ucpfcRg5S5NGvV jHKtJDk+zfjj/61x7qtljDnGZqlIvkpI6OTX4HEBahSPV/sXrFQeIOgJgeqiVF6laVVnROy9j bTJPJGVpFuE/qcIsD3W808mPPcdNc6jTgk1zG/rBm0ZvTSomauw2vGXIbhffJfhzdBW2slVaT Gin+W+a4TGBUcL0gyRo7aqyteZTBKyxdkIg0nw4vJcjPKW+cUe5+uQjM4l3janiKzueKCEvYz kIKZmMgNo6EmMduBcTmwoLWDP2iQ1gaRSURLJ/crfaBqFpYWHyjokPpG8FGIqxuzvJyORDZlF V5Xyf/pFHu7YS+jv/IUwA7GkXSLZ37aPCzfkYTTUeTPMW2/YzUWRtJ7ZhTGtjUMfFUnWHEdnH E250o/3IpXLEybiHenCaSQtJc8g76BkXCq9CxB0CQAzoLozi2lKEWsrxJDJ8a79qyxsCBPkYY iQgPrcMs8UxP19Q45exUMMGCHMeFWmnr4/so5Tgr5ma2fqrnUpNF0J93xu6Rw06vW2VFFmaBU SpPWFf5/c34PgCq2X24AHut6aYYgmsQqhh2TX47nGsbXRmb4fPpXgkRj9oZvCNTzdwFMZQNZl tzhtCpELj5ErpbacrmIWGT5fVLTsjEdi+nwKm7ghAoHkHK1oPKuhXHaF8Wu9dHSGk/PRTuwHm caeTQ46H2g7qzDqQCWGdFdbq4YJ0m62d+JN3Udnpezs9T5OlX4Y0PrLuwS+bhBw5gj38TfKME bgmJbFY 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 12:23:46 +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_dmm_tiler.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c index 4ceed7a9..7b32dd3 100644 --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c @@ -917,8 +917,7 @@ int tiler_map_show(struct seq_file *s, void *arg) h_adj = omap_dmm->container_height / ydiv; w_adj = omap_dmm->container_width / xdiv; - - map = kmalloc(h_adj * sizeof(*map), GFP_KERNEL); + map = kmalloc_array(h_adj, sizeof(*map), GFP_KERNEL); global_map = kmalloc((w_adj + 1) * h_adj, GFP_KERNEL); if (!map || !global_map)