From patchwork Fri Oct 14 11:41:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9376455 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 A69B160779 for ; Fri, 14 Oct 2016 11:45:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 949392A657 for ; Fri, 14 Oct 2016 11:45:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 873F02A658; Fri, 14 Oct 2016 11:45:15 +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 391912A652 for ; Fri, 14 Oct 2016 11:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932162AbcJNLpB (ORCPT ); Fri, 14 Oct 2016 07:45:01 -0400 Received: from mout.web.de ([212.227.15.14]:53959 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754716AbcJNLm0 (ORCPT ); Fri, 14 Oct 2016 07:42:26 -0400 Received: from [192.168.1.2] ([78.49.117.2]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MUSOp-1cMCkV1HXf-00RF67; Fri, 14 Oct 2016 13:41:20 +0200 Subject: [PATCH 1/5] [media] winbond-cir: Use kmalloc_array() in wbcir_tx() To: linux-media@vger.kernel.org, =?UTF-8?Q?David_H=c3=a4rdeman?= , Mauro Carvalho Chehab , Sean Young References: <566ABCD9.1060404@users.sourceforge.net> <1d7d6a2c-0f1e-3434-9023-9eab25bb913f@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <74b439c6-fa6f-1f78-424a-ebeb6c8bbb4f@users.sourceforge.net> Date: Fri, 14 Oct 2016 13:41:18 +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: <1d7d6a2c-0f1e-3434-9023-9eab25bb913f@users.sourceforge.net> X-Provags-ID: V03:K0:BMWS6j7U7m6HN+B4yZT72cicgDBUV8BfnbOi6GOV382AQRSoF7o JoN9ZJPWzEPXVhGTSZ5i+YoA7NNFKds47A7QAL5WUP1XPK+15mxgp+qipDEBoowOmS3sGfY /GWjg6J46HMdhKC2Yb/exkoGYhk5UpwFWbv+gTuR/wOfwstex3WMaVI1mI47wGFk30I9XQ3 P3UtRX+HVbobpm+9LKV+A== X-UI-Out-Filterresults: notjunk:1; V01:K0:hx4MhBLA+dI=:lcaN1aVSWCcgYs+PFgpBi2 hyCWXAorVDkNoZoLORT2AwNVY8I38rIuL/MsmAcq0dc3VZD0nVboU6Ryl9CD9N0gHCuHalEnK oor7g+dZqNlQjyOFnm6VZb2bqpYJkW4p3vdD7+VYslMJ7kJ4XXT0L7/w7qtU2XeCT2UQRNYbH PT/awFyKF8gBSc288BlUfaIJfNxkcOEgxkw4Uw1/7hHbUaAGfasfCI/deOg/O83a0SHplI06t nzDJrKaHbxK4mSqO9itiO0LGje8PdbxavDJhGYWjNkdKW7FQHOLn5ulPpWV0CxX/KusjlOOPI iSyTwMDUATYDWy3SPI000ir9sbrIi3p6es9o7W0S0VgEIkA0GemYEGFSwzOj+UtFQ5eKLKhRm OW5bTob0UU0FVgcRdVfAy6GpfXPmJjOGesk9RsAjeOSfRgBiG54k0H8+YosDpr4lULlyOP/aA CXwnNrTyISLFwoVj8YiAKx/JbrdQ3nvX/fPHauDZfD3wdeN3diUvG6EBwOzKxkRkAHH5K6nMr ZtqkPnRva7FwJ97cSYSvxqrptwlE5F/D7MXvTgHMBiuwRdkAlkYOaHWH3VxGJjfHk5Kup+C3J PRURYxpY4XpLv9CK5LLzoRo87fqQUFTGJlwF2Fqf/ilGvj7Akmu22exIODw/DO3FqCPlLC+6i 9b+cERD1RwR4G3x6JTShT6qaZzHYdIWiomYbj4wnzr9/6K3dOZJvWGX+/igjH87/edtGfHMw2 CcpXXfy1bb2q/Xyvb8MaWhMDQbEQSgCJEkow5C81jLO6dnnFt9tfp8egKi45LR66RtWgDFTJB nMy2nBh 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, 14 Oct 2016 07:19:00 +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 Signed-off-by: David Härdeman --- drivers/media/rc/winbond-cir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 95ae60e..59050f5 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -660,7 +660,7 @@ wbcir_tx(struct rc_dev *dev, unsigned *b, unsigned count) unsigned i; unsigned long flags; - buf = kmalloc(count * sizeof(*b), GFP_KERNEL); + buf = kmalloc_array(count, sizeof(*b), GFP_KERNEL); if (!buf) return -ENOMEM;