From patchwork Sun Oct 9 19:56:37 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: 9368647 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 5CC526048F for ; Sun, 9 Oct 2016 19:57:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A26728B4C for ; Sun, 9 Oct 2016 19:57:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D9A128B51; Sun, 9 Oct 2016 19:57:23 +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 CC3A628B4C for ; Sun, 9 Oct 2016 19:57:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751997AbcJIT5A (ORCPT ); Sun, 9 Oct 2016 15:57:00 -0400 Received: from mout.web.de ([212.227.17.12]:56234 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750975AbcJIT47 (ORCPT ); Sun, 9 Oct 2016 15:56:59 -0400 Received: from [192.168.1.2] ([77.182.43.140]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MZUJt-1baz2x0P7t-00LAqs; Sun, 09 Oct 2016 21:56:38 +0200 Subject: [PATCH 1/2] [media] blackfin-capture: Use kcalloc() in bcap_init_sensor_formats() To: adi-buildroot-devel@lists.sourceforge.net, linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , "Lad, Prabhakar" , Scott Jiang References: Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <581af7b9-030d-9d65-02c5-53bf11d40716@users.sourceforge.net> Date: Sun, 9 Oct 2016 21:56:37 +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:06DSlaB+A/00SbU9+bklzfhWP2aAWcGQCZ1vgDKf5WXyLBo46TS E+wiQqnGXFriH1Eb7tDDSiUTGTmvKDeJ1H/Oqf6vOGK36AYtaxH4K/f3Cekt2GlWkvIcgu3 iqKj2xm636T9/NCWC52PzgLjZRaOKN1/2nJ1p8vk2bTXICIkOF1P0hABe+4FVhOcy+SsQm9 cG/iZrhhBl8tYC2xMHl0Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:pl3/S/OrFS4=:33O2VnFj7T1XnX2LIUNKbe DfPaz7HYuGzGn2jjFuRSqjf5LyioPdaaz/uQQ3qsrS0sLusQ9YUtCyjaWlRjFyIfRf5KjNSC+ CBLnGPs0BOjw9eCmBqyfVluF7cjwOj7zKllMEClQMZ3UYKw4Btb1/XMclpbgQrZt9cHrTpvhG f0WgCuQf5hkJqePNcONAQAWPcKyZFE86wY8q3CzleOsD5y/9katkzQ/QGaQnxIv2Iy4lF+FKR KrjJMySumTwIHLiyX2BmVyH93IbWiS7ESF4WKRfOmIUhz/Ysm9BRwNBfTrrTcpPah4DVbOrvl frYz5QiLMQr14HWVreEbx2Vl2O62MzwnYEJHUAc/HFbs6HXiHAWzDLJnZKKZE5mSzisoKiDj4 Ie10mq1pv+jLF6eyBFO5w8Gtpw17wWBTbhq4FY9DmS6NS42siVrl0mZ8px+iXAGO593nRV9B3 AbKg5miWSGiSn96L9tc2iBj/GftkdHIc6xdwY4k2nK/Es3Zh1pWmeKFO8DLOsnR9Xs8h1Ejer BqssEKfwlPu5suUcq85hswgofliLTgUHJiXReQgwR6WgXWfnyIOHh0MO5Bd+RcH6fiNU4R0Ef 5F84tL6Vkge+p06yHL5/S//mUFwjaEZrbwyJocSyAh/C6dVCndYti/IgzW6y1EYh6oX7UXEAx SC87aZfM+P7wg17rm0TKXY2i5qeEGg6CuKCGWFp0oZrvfPnFirGqzkIkN0KZnLvggHwB31oLZ L+psKFMwLfgwFGgV3Jbc4LRpHirNo54cgkzTP7F0zdhOn7TgYcjG2YeWcpp5reL5BKeWR5H6B iib9O3x 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: Sun, 9 Oct 2016 21:12:13 +0200 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/media/platform/blackfin/bfin_capture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c index 8eb0339..c5e1043 100644 --- a/drivers/media/platform/blackfin/bfin_capture.c +++ b/drivers/media/platform/blackfin/bfin_capture.c @@ -169,7 +169,7 @@ static int bcap_init_sensor_formats(struct bcap_device *bcap_dev) if (!num_formats) return -ENXIO; - sf = kzalloc(num_formats * sizeof(*sf), GFP_KERNEL); + sf = kcalloc(num_formats, sizeof(*sf), GFP_KERNEL); if (!sf) return -ENOMEM;