From patchwork Tue Sep 20 08:55:53 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: 9341339 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 EBF3B607D0 for ; Tue, 20 Sep 2016 08:56:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC83629D49 for ; Tue, 20 Sep 2016 08:56:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D01C529D72; Tue, 20 Sep 2016 08:56:06 +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 B201229D49 for ; Tue, 20 Sep 2016 08:56:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F26A76E6A1; Tue, 20 Sep 2016 08:56:00 +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.3]) by gabe.freedesktop.org (Postfix) with ESMTPS id F19AF6E6A1 for ; Tue, 20 Sep 2016 08:55:57 +0000 (UTC) Received: from [192.168.1.2] ([77.182.226.232]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0Lvjoa-1au6zd3ftU-017Z26; Tue, 20 Sep 2016 10:55:54 +0200 Subject: [PATCH 1/6] GPU-DRM-GMA500: Use kmalloc_array() in mid_get_vbt_data_r10() To: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Patrik Jakobsson References: <566ABCD9.1060404@users.sourceforge.net> <3c9785ef-4553-2e3d-2cb2-5cf6d1f31ccd@users.sourceforge.net> From: SF Markus Elfring Message-ID: Date: Tue, 20 Sep 2016 10:55:53 +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: <3c9785ef-4553-2e3d-2cb2-5cf6d1f31ccd@users.sourceforge.net> X-Provags-ID: V03:K0:tvP9PrMngnfY3W62uKvzsdTCsuHsCEjVQCCbXLUl7Id+fVzIJXx Z5XpFpJAn5J39n86KfG07xJR5rgrwxTyPqsjFaFZfR8XhB/sXfzXUkvvOPKr+eftLEGIhxX SFC+Ez3NBV+F+3VZNuNXz9EjmY0qrfunveNT1wVQNunTuqQfImrkxoN69nMXx48//Lw89Er je17MfnILQOBbEYwxty0w== X-UI-Out-Filterresults: notjunk:1; V01:K0:ljXcexdmgqg=:zAsPbCJD9RbdiExOjuMyZV xhyVz+qhDBfNoKSPjTXPOi52OvjyL/r4XwcaaLv5CQ1Ddq2LLyDrduPeLYm8JH4vv0TJNeyux EF/ufDF2+/O6Ub12jl+6T/FGZECKbWJC/kJTi0+sP/Md/vIURyLD/SQ8WOS7m1Xsgro/7hF42 qqX7LrU7U3xmgd2ffTMjOAyfRUOpuDq+TfGrZoIr75xALOr74WD3z24mT+Qqi+fQDJ1+K7cZA fXe4Vm0MaR7zpeEZ6nedGlHEPeCN7Niq2AJFLod72DNsJLEgt+Nni4MjBIOB9lXehPSnYpPlg CHfSSTgvsiTD0aPGiJyy+HJfU1mYHtHJZMxt5/gwh4fEA8r33Ya7GYovTQEkqcqSnsciS7hal t3ihTvHxVLllItQGfnqSGUneRnPNepVwBl8KcXGSNYTUFSJxsPZfbTdrUdd63Pht1yW6Bbv1V HVrI6SGwIHIujgNCjQdqPbiqaGAjIP2pKlySi/IXT/JNJfW1WQu0/JEWXnrqZRm0tYeHjSYaC Fu5/gLFsOL5qe7ne15TolkLLl3EJByXaf8V0B8cJ/BP+bkmf2EfD3hy2xAr1Hu+TQRNKOUw6X bSlVbXYFm2z9JPjdQqBofjf1I9GY5Jqm6ytkeBT1+vp6VpXXNZgfJIi5C92pDJWmOXakn5HC7 faKWXoZFDT2MX2qyD83v9gArdjkvX3S6ypX+nwqms5jOIgA3Ou2+PfWVaNXT3FW7bDOuUTg9v GxHD3iNJ9pNbjOY0SdL3l1l0sPHKOMmBbIH69ZWS0dBce5VvIMAvn/F5hIy6DbWIsFG2LAsUP 8ntEVdZ 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: Tue, 20 Sep 2016 08:54:07 +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/gma500/mid_bios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gma500/mid_bios.c b/drivers/gpu/drm/gma500/mid_bios.c index d75ecb3..a833568 100644 --- a/drivers/gpu/drm/gma500/mid_bios.c +++ b/drivers/gpu/drm/gma500/mid_bios.c @@ -235,7 +235,7 @@ static int mid_get_vbt_data_r10(struct drm_psb_private *dev_priv, u32 addr) if (read_vbt_r10(addr, &vbt)) return -1; - gct = kmalloc(sizeof(*gct) * vbt.panel_count, GFP_KERNEL); + gct = kmalloc_array(vbt.panel_count, sizeof(*gct), GFP_KERNEL); if (!gct) return -1;