From patchwork Mon Mar 6 17:40:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9607223 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 2FE5E60414 for ; Mon, 6 Mar 2017 17:40:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03A9E26220 for ; Mon, 6 Mar 2017 17:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC9E427BE5; Mon, 6 Mar 2017 17:40:57 +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 A812B26220 for ; Mon, 6 Mar 2017 17:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753041AbdCFRku (ORCPT ); Mon, 6 Mar 2017 12:40:50 -0500 Received: from mout.web.de ([217.72.192.78]:61242 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753027AbdCFRkq (ORCPT ); Mon, 6 Mar 2017 12:40:46 -0500 Received: from [192.168.1.2] ([78.48.114.236]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MF3jD-1cVpH02eB1-00GFYR; Mon, 06 Mar 2017 18:40:25 +0100 Subject: [PATCH 1/5] IB/nes: Use kcalloc() in nes_init_mgt_qp() To: linux-rdma@vger.kernel.org, Doug Ledford , Faisal Latif , Hal Rosenstock , Sean Hefty References: <502a5a6f-ee91-dd2f-cdc7-63f396059529@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Mon, 6 Mar 2017 18:40:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <502a5a6f-ee91-dd2f-cdc7-63f396059529@users.sourceforge.net> X-Provags-ID: V03:K0:ybbHX5gpTCL+RKrGAD5SLtg4/WGyFByx4bmSpxvdg4gXbzjVAXT 0tGT8QwjovZRyurit7ikidTlFVvxmILEooCjpNMl2Rg8fpRdbqsOnjA6M4Ou3axd+47+IvR q2Zwed9JflF40klDtqy61dVcMUzg+4keDyx6HHT+wyk4wIBe5vOLZ/CSqn+WePCSAuopdpo t0It0wQJL++Vgw0A/sH2g== X-UI-Out-Filterresults: notjunk:1; V01:K0:abnx2cR1cjg=:cxfs62PmUoUReQgGT9gGHX 9DtoJCNBiBv7v2jYIVQDMkhhJae0AoqXqWF5SUoDkKrfEb87bbzdNeU6olDfJ4TKGzvFrFq4t JLDSLPxUe2Xpsg7xww8ewtzw4322gQQPPnBUyyj4SVxxV+DsXTAICQ+FhqayvL746O0eZCU7X lMEW4D/+lxxs0YDk8GmTMTittdyd5ddtbyXd9QyG1fVNtg901xxIFW1eIWHN5cByIDVASJOwi YphcF/O67WOX0eUQ25obYzeNY/W1OJy5VEnD73OAT+JHuc33F4x56NFLzlaebVGC1Q2bkGhvK jQUGfnCS6AvCRq8E1tFVRynj3bT8mBu4HoZWKY9hX4tu9Up7LwoAFbCpl/TJy53JX4+fnP49E QXSc7Z2vjZ6QmwXBX5+URqWNelApZO+ec/VvUo03YlkbwVQ0uLTCEIq9Pc0iZP5R0tnyZYLOp JMqKqe45816E2Hy9nRVSattMnq1fR5twd0XPywNuGwWl68mgSHWD/4KVWEm+mFf1OLgitpkYo zb0CkjKDAlUYcgG5l3oYy0M+Dl2aXG6D8JTvzIiGWl2ptfe8SSWyFdRck8u/zEDrGbS3Ddbwn BT9OEdJPGO1T2xE1hKeBD45iVu8RrDfVsIJBEzRyxsLgNKvd4pLZCIOfkhE425Ic2WcvOJ3x/ J6VshWb7G+aQ3I800Zl2nfkogcXPSROPDKgaaWLAILvzZjpg9wPne6DFmuKmPPdT2JCnsLvAD qNXsNSFzGQdwbORCVLg3xfJhKPlO8lhrbMPhwpIciaJjnHWQDNEJQiUvbQDQsgY2NpHZ0SKpL XWR58b2 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 6 Mar 2017 16:07:41 +0100 * 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. * 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/infiniband/hw/nes/nes_mgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/nes/nes_mgt.c b/drivers/infiniband/hw/nes/nes_mgt.c index 33624f17c347..a84fffd33c21 100644 --- a/drivers/infiniband/hw/nes/nes_mgt.c +++ b/drivers/infiniband/hw/nes/nes_mgt.c @@ -877,7 +877,7 @@ int nes_init_mgt_qp(struct nes_device *nesdev, struct net_device *netdev, struct int ret; /* Allocate space the all mgt QPs once */ - mgtvnic = kzalloc(NES_MGT_QP_COUNT * sizeof(struct nes_vnic_mgt), GFP_KERNEL); + mgtvnic = kcalloc(NES_MGT_QP_COUNT, sizeof(*mgtvnic), GFP_KERNEL); if (!mgtvnic) return -ENOMEM;