From patchwork Sat Oct 8 11:47:49 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: 9368107 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 CAF126075E for ; Sat, 8 Oct 2016 11:49:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD2A329986 for ; Sat, 8 Oct 2016 11:49:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF66E2997F; Sat, 8 Oct 2016 11:49:42 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 566962997F for ; Sat, 8 Oct 2016 11:49:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934997AbcJHLtL (ORCPT ); Sat, 8 Oct 2016 07:49:11 -0400 Received: from mout.web.de ([217.72.192.78]:62030 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935004AbcJHLtK (ORCPT ); Sat, 8 Oct 2016 07:49:10 -0400 Received: from [192.168.1.3] ([77.182.84.69]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0M5OYl-1ax8O01kwZ-00zYth; Sat, 08 Oct 2016 13:47:51 +0200 Subject: [PATCH 1/2] [media] cx88-dsp: Use kmalloc_array() in read_rds_samples() To: linux-media@vger.kernel.org, Mauro Carvalho Chehab References: Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: Date: Sat, 8 Oct 2016 13:47:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:Ow1rCc4xKsXRiFP+bo4PGR4U09wlav3RPROYf2LBi+tuv7br7PZ pZFXESlW4eCKX5ICCMNQD1hAhXkizkzlxHH5Szzg0kM+R/DV8MDj8ZZoKUakYtZuUxrFaAS tFq+kYEXSWwEqZw2w9XgndHyL7ki1ySPHg7C/cVAlp1dmJ1SrpTKxi7oYszjD/WKk212sJz 3tflFqIiP81Q3GgTQ/yww== X-UI-Out-Filterresults: notjunk:1; V01:K0:azSNvEPOCwY=:6m/xwCK8iBTOlZSjsHS8fa axKGMRM9vm0UpDqogLC6yX1gB0iBjQ1DEA5zvvTkj2sm0pL8POi+PKdoGAv7PPy9SfQZSAshG dkPPLLMRCNw4EHR9CeVfIhUNNW7QDY9S41zAZ0OntyyArB99bG5GL1/MNSG1VFb20/gDs+9qh w3/ciKPlp2730eiNx1ot2jo2Wsf3aEoxfTTHTV+C1AtslsDfRW3JC+/ENGTyDgpp3SpJxJbjC 88Ln+JbLyFvhAAhMR4QTkJ/XjVnEWJ1PyVyguw1a1hqzDutsp37bqX9x40l87nZjwFGkKBQln pogZbY6SvYebbeXg4+HVQDUoDzXZT5IOF3HPZoI41iNJJyY1gBwqS8gdZGYuu7d2L/RMfGKfZ ZgZbPgu9cibMyUWF2biXGMFe4m4kmDLBUqqm67U9WZk8IWvxA/yMctvCnOIFCVKkKoU9rQPT3 k1Yh4cFQTH3yzZFZQLy/673typehemmvQKToEuCJ0Ch/pbUe8axd/K9K2WLnhgeE8uV17toq4 3s7QoYi7Xxw/kQ4qqnLGodorYNvuwY3q1yX/IH/ACrMINJh6Zr7GAHVEH3G71Zfv40GYELcPj eSfaMcbcoaB+C7iCHZCpQVP9vEMqNjInL0t16rGEMlyrl0Im4ORBkl7mSSQMveDh+L8NsqU4f +vWZKbNETXbnu0XIA6vIJT7chwMajgycE94tHKCesVEN3gjui1l0TeBzi+ofytxBukkjgzRqZ W311wFT84w+ZvqEJ4ydL49q1fCxqge83UDyekeymoNEqW2LbHa/zc2G0jkbZ1JReEO+/JE+oo irqQp4o Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Fri, 7 Oct 2016 22:07:27 +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. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/media/pci/cx88/cx88-dsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-dsp.c b/drivers/media/pci/cx88/cx88-dsp.c index a990726..9acda12 100644 --- a/drivers/media/pci/cx88/cx88-dsp.c +++ b/drivers/media/pci/cx88/cx88-dsp.c @@ -245,8 +245,7 @@ static s16 *read_rds_samples(struct cx88_core *core, u32 *N) "sample_count=%d, aud_intstat=%08x\n", current_address, current_address - srch->fifo_start, sample_count, cx_read(MO_AUD_INTSTAT)); - - samples = kmalloc(sizeof(s16)*sample_count, GFP_KERNEL); + samples = kmalloc_array(sample_count, sizeof(*samples), GFP_KERNEL); if (!samples) return NULL;