From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932741AbcITKGp (ORCPT ); Tue, 20 Sep 2016 06:06:45 -0400 Received: from mga11.intel.com ([192.55.52.93]:9141 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932560AbcITKGn (ORCPT ); Tue, 20 Sep 2016 06:06:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,367,1470726000"; d="scan'208";a="1059417875" From: Jani Nikula To: SF Markus Elfring , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Patrik Jakobsson Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Subject: Re: [PATCH 1/6] GPU-DRM-GMA500: Use kmalloc_array() in mid_get_vbt_data_r10() In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <566ABCD9.1060404@users.sourceforge.net> <3c9785ef-4553-2e3d-2cb2-5cf6d1f31ccd@users.sourceforge.net> User-Agent: Notmuch/0.22.1+63~g648dcc7 (https://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Tue, 20 Sep 2016 13:06:35 +0300 Message-ID: <87vaxqlwb8.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Sep 2016, SF Markus Elfring wrote: > 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. Did you test this running on the hardware? BR, Jani. > > 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; -- Jani Nikula, Intel Open Source Technology Center