From patchwork Thu Apr 6 20:09:45 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: 9668347 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 39EA760364 for ; Thu, 6 Apr 2017 20:10:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B9EC285CB for ; Thu, 6 Apr 2017 20:10:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DA52285D2; Thu, 6 Apr 2017 20:10:06 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 02FC3285CB for ; Thu, 6 Apr 2017 20:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752432AbdDFUKE (ORCPT ); Thu, 6 Apr 2017 16:10:04 -0400 Received: from mout.web.de ([212.227.15.14]:63996 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbdDFUJ7 (ORCPT ); Thu, 6 Apr 2017 16:09:59 -0400 Received: from [192.168.1.2] ([78.48.224.88]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MJTYJ-1cy9nU0nDX-0037cn; Thu, 06 Apr 2017 22:09:47 +0200 Subject: [PATCH 1/2] IB/usnic: Use kcalloc() in alloc_res_chunk_list() From: SF Markus Elfring To: linux-rdma@vger.kernel.org, Christian Benvenuti , Dave Goodell , Doug Ledford , Hal Rosenstock , Sean Hefty Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Thu, 6 Apr 2017 22:09:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:eL61TTj9qr5j3bDPYi6dfLYBX0kflqo2EMJ6wDuMPIHQx65hrt/ ieVRDaKdKa93ASR3pVOMHr3c81DNi9mx+hZFp0+z7yi6DMAmj6c5XhYu/oqqChabZ4s9a+p vCYUKEk0m2yVisGkwtkDRzstsoWV6QZnVx8FyKROXkozslJG3Vt118s6/h26C4NTvHdhtra 7trLpnc0LcD/LhL4yB09Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:ts0zo/YUDVg=:jkeLkl7ULWGYAJgPdpfLjt 61ue5+Va2oq7ACjHQbv6Q2ICttjrVEC4ibfSThP/qlr5fSrG0BIMSivkju0sCLtA+uTKVIbLC CBymMwUCdXxzuTxRs/HtMCGPXHn/yp70mssz6akEPkJ7ok7X0eUX9qyNAnAL/Ee66DD/mkcPy Xiz4mhXn/7uNaww/HLx+0RIQE4GD23gw97wS1o5BY7Ksm+AoVmSjpMIisdQA9dGC7Ebj2crKc vNLR6AYQfg8yxCV1AUhdOGqp3MPRSc43bktIHdjbR6lzK4PKy59qVCxYmrHCKM3Dq4vzRn4Du Eng6PUxXdScKeTRPB//TWURmFER+xQK8YMwviv63RgnLc3WFzwBTa0NQQQDkVcbb9+aBZIp8u mNuIiim7+Eb4Cg7dVyYLiCP6KpS1nLaeoIp37oUoyLtWHkFgyQzTYgYMNKgDNhQOlUsaugDfK 9nLYJsOxlI7rVJnjtuzv2LaF5U1VrxZk/GEDvftT291NfV2WP5eXhsi31HqPDge0wzE+2VgsO xmZpIQ1jTLH/jJlltw0jLyJuGN3PYrr3lcrn+Trjf7HSFdrquhdhPpXjXuXkHXhEOc4W5wf7w iq5EV/x0RtZ3j+Q6M/7ne4sCXRbljuCJYqF4mwmFlCpeerSy2PFkMoO7XaCOHeY7poZj/xm95 UQpPV9dS5HRSWbNvxbWd2fQeQfGMZZNeAZURHZESy78f822HjX4unWlpg2+WADDultn6seEJY 9iL/XhE3Kk3Hs21YgG7azSudYesIXvYwh4zzeJAvazaLQvGn5X0ABCy6y4v3DDoOAbTD8Y+5S 2Ty88HD 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: Thu, 6 Apr 2017 20:32:39 +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 "kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c index 092d4e11a633..817f0475d9fe 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c @@ -545,8 +545,8 @@ alloc_res_chunk_list(struct usnic_vnic *vnic, /* Do Nothing */ } - res_chunk_list = kzalloc(sizeof(*res_chunk_list)*(res_lst_sz+1), - GFP_ATOMIC); + res_chunk_list = kcalloc(res_lst_sz + 1, sizeof(*res_chunk_list), + GFP_ATOMIC); if (!res_chunk_list) return ERR_PTR(-ENOMEM);