From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758013AbcJHLzC (ORCPT ); Sat, 8 Oct 2016 07:55:02 -0400 Received: from mout.web.de ([217.72.192.78]:54251 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754882AbcJHLyx (ORCPT ); Sat, 8 Oct 2016 07:54:53 -0400 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: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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:ZS7idcpE6iA=:QHDC5FSt0X8FOUZDprD4EA LPwa3kKDaiZeQDBMTkPzeyuTy8i6ZxQr1ikrdi/GFDfbxC7t6pZWJCVh4ChxisWhOxdTRW2zf bM1rd5jDgHwXSB5P5aZ65I7sgXF8A4iEG3GgSrlE/TbXO1tibk+ZsKXFavjImiSTpOqdAly5i m81tNfrVv9nojs/7BP9n64m3W8/W9+JWbpR+UzS25bwjLYYc8tvdqOi/vxcFd/z6WgWYhQp5t bZeebGlFS4pu6qQ2JLtAeopOX1qle93Jf/UUYJYMQjwPF8o5k6SsEBYiTH2+rT/3Kp3qpwQdb wb/okTeNoDsTpYWeKKSmn3NVrCzflkVqjlB3WzwjM5O3BIanKI9IPz+AUw/Ot5J3VhOht47FX k6VjfM+PxU9JqGq8xto5Nz9vlelOf/BXE8dVy9EU7U54RuaZe2jkqUOKlA54aPjkWTUteFvin ugtZAwnjl2BpV8+VLUTxvJe+Jotf4N2ltbU2gY4FbxcEpz6zH4/2tucIflE7/ypUkW25FUhb1 tfIwEClg1k7rNqLoLf56R93aRXbN1+Q2ypHXyXvPbtzwpDlz8h2OvSOnrA0Iyo6imgEskixRb 5Ymc5fLnZ3xtIZn87/raMCyZNQYsOuG2ZZlVQAqU5oZ/9GV20pdjHs4JBACikfDlJfABZtDae Jl6wr02XsYNSzQvEUGoPHE5IzTumOBd1ddLqL1NYzVMewi1+MXdmWHt7isLJrjaj22DxVQGxm QG63/pW7RAJuzc7t9E0SdyNEIarhuFJ7Qjovilw5SB/zDgkj7+OOX/Ns2PAx3NuCw2o91gzbz AszDDh6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.10.1