From patchwork Fri Oct 7 19:45:05 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: 9367445 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 BF457600C8 for ; Fri, 7 Oct 2016 19:45:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC7C2297F0 for ; Fri, 7 Oct 2016 19:45:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F51829832; Fri, 7 Oct 2016 19:45:46 +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 529F3297F0 for ; Fri, 7 Oct 2016 19:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932697AbcJGTp3 (ORCPT ); Fri, 7 Oct 2016 15:45:29 -0400 Received: from mout.web.de ([217.72.192.78]:59434 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932611AbcJGTp2 (ORCPT ); Fri, 7 Oct 2016 15:45:28 -0400 Received: from [192.168.1.3] ([78.48.87.168]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MDPEX-1bgAMY0gRB-00Gsrc; Fri, 07 Oct 2016 21:45:07 +0200 Subject: [PATCH 1/2] [media] dvb-tc90522: Use kmalloc_array() in tc90522_master_xfer() To: linux-media@vger.kernel.org, Akihiro Tsukada , Mauro Carvalho Chehab , Michael Ira Krufky References: <566ABCD9.1060404@users.sourceforge.net> <906cc86f-bac0-fd47-8a6f-d3310b10fd08@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <78258072-609a-c887-11d9-7206c3e4d2a8@users.sourceforge.net> Date: Fri, 7 Oct 2016 21:45:05 +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: <906cc86f-bac0-fd47-8a6f-d3310b10fd08@users.sourceforge.net> X-Provags-ID: V03:K0:JDal7S2Ptfd91AREQ07BwIn28FOzAP1AgRwQ1MG/rZRfrrFB25L CJ6uVtk0P1hSA0BGD7pGCTfeyPRjYgGyD6+GfXcQQC8LPOzW4mTcoJKT71MrRnVfptV54p+ GW3LKmiiDT0FOCvMqnhOHvlVYvruthIFE/PpF3W3ldkp38GSrHi+44Vr+cqA4xrpSXPiKbC vEcBiROooa3fllwI5TP4Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:URrxm6p+wiY=:oAMDjbC+1rOH3SqwGBlxRJ 5AnIi6A+p1WLg6CXoMPED24bXWWlG2gcUaQzGNgkHReDsnkVJAYOtfnCt+CVJeFrUfpgD14qd XhNM0zTUyNV7A3ureA+efwpmtCmoYuBtR/6o5Wa3vwahIc9uRMBiKvQ0qxs0Jy5Oa/tXhYmmu nfKCbhjt6RStiPo3lxJHbTseqtRPG3JdiiI4EWCn047qf4zftGk81OkUr0PuOgMt5hY3iXI5n +Uk3HQJprz5xB+AMZFCzVv0zyNGvCiPTAIAtHisgojRQGTtpL79zWv59b5hGmd4JcgpuqGF49 E7slMHZY8dhiZFb7In7xtmse7DnMnhiWrW7OhMrQ0511Q5m24EP9ItsHvBsB6A0gEpudRahhX zpv9EtTLbQEa9aqCHysEBo5JduQLnAyowlWimtWbWGT0O9G4wL/ayYLjBhX5HOrjSQZQiWLBm KBTUPZ1lJnXiJbuSA/ZrHCoSlf6UgGbsZuekmS81c676leh+qsTzMomWoS053thD/YLisI9h2 RTJSqB5RBLY3e9jnZLKDRiRIhjkNoAFmEiItd7kE/umPk+BNeFFJ5bZWEXU+2cq4klLrGapld Cn+/No2J9qEqiFU5FcK/ZVpNIlA5xyANdVg7JEcD2ovq4nmEahY8CcaOSCeWJrIZr4APYAx3C 9E5SFs9j7VgOW1omDN0gvqkVuzVFj9S3qqyWwEjzWY2e3vkjYYHkptHp25w7yLUrJlTWCtGIq 3CocXhbnY3Wc1WIZaQaqTYraktr6p0l+I7yE3R4aWvjEjuUIFsrgcqgz76W+S5d5nZ3ESkKza 3MvQ+Ja 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 21:07:43 +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/media/dvb-frontends/tc90522.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c index 31cd325..c2d45f0 100644 --- a/drivers/media/dvb-frontends/tc90522.c +++ b/drivers/media/dvb-frontends/tc90522.c @@ -656,7 +656,7 @@ tc90522_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) for (i = 0; i < num; i++) if (msgs[i].flags & I2C_M_RD) rd_num++; - new_msgs = kmalloc(sizeof(*new_msgs) * (num + rd_num), GFP_KERNEL); + new_msgs = kmalloc_array(num + rd_num, sizeof(*new_msgs), GFP_KERNEL); if (!new_msgs) return -ENOMEM;