From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013AbdBHVPg (ORCPT ); Wed, 8 Feb 2017 16:15:36 -0500 Received: from mout.web.de ([212.227.17.12]:61987 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbdBHVOG (ORCPT ); Wed, 8 Feb 2017 16:14:06 -0500 Subject: [PATCH 01/14] RDMA/cxgb3: Use kcalloc() in cxio_create_qp() To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Wed, 8 Feb 2017 22:11:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:cVs0cUc7p3VbRMc9EqhDifxwyDaVz47lvbzZA/yBK9RABB2pEpd LJQMppZbyEg870whhD1UUujpAJGDJ+lxJiEALxGIGU9dNB5PqOjrA1NPNhUycCeUmLhekCL pHjCVS+Rb0thH1/WafeA6kngLnNWAfBo+SZ1zOafufOuVM1ipD3G19w++ZYbDp0jocvCrRm qroaXxEdvQr2iBNFsq3oQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:Bn4Z4x5BAU8=:IuwwqGqGQ1C6W27IRuxoTx iV3xTysigJ6JLI7jRzuuRXFFBFenUk5XX24IJaKXYkPhpxhCffpot3ZW8xKMs9OPf/Ju1fLHu NWwRgBxC/3MaIQSmn9/1QjsVFXuL3Fo+4PoKWdcCZMGvunw/CWacj5fR5h/HiFzmNkKYjKZWf p00I0EY1bqoPu4ERaI4W8QevDUrnuB1W67MJSYzh43Pb1NVmlQ5I5nIamYsDDbKg7Rw6UwvG7 ajbdX7QWIyppedIz0FvSBGhlWxT5xe5vESZT6sNFYhoRbKbPYYOuP5zxwr6cV487Bt1nnh4pw 8GuRXpYtRLKOivGe6bZvQMLVqiSAHJI4GeCjvcTyqUcD9BwkikR94smCLHwgIUOlHS8BSABwX sKtFKF4vbM3gA62xS3/uz0SPFDhAUmT4+E/WUjKAsUldVbN/QXCuo60rC0L3ZO/no7f51ZpJh 2e9rPIASGL1t2K1jwIU+Uas/zicfhgSXsclulA9UjqBoIqTPcxISD09FGlSqS05jiArSpa73W lZydmq49d1GoVlmVntO2uRN+O1kCc8kSq2uib+jCxXw0blXhZcWU0hB+L7adXthYiDooOL2nN XnKjCu82Vzz7qayNyMpShh9saIl8IGK05m9noOF/v4I9E/Ji1q3wG5LT7o0diaAWO0ZlIiw3P CMRXM9QolQedpOGTM21FVVKHyrzUApDomuyhRYOkoA90Kx5VtgWkvVRTnO6N4D1IJ9xm6LAg4 Qk5NRWGca+3SX5j6tfKBJCz/5NqVsKfaQQamKidDD7D9yNkTKUGAw0+/Ji84ZZRLBHSO7gPZS i85CNSM Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Wed, 8 Feb 2017 11:37:13 +0100 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data structures by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/cxgb3/cxio_hal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index ada2e5009c86..aeb1dfa8bfe5 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c @@ -281,7 +281,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain, if (!wq->qpid) return -ENOMEM; - wq->rq = kzalloc(depth * sizeof(struct t3_swrq), GFP_KERNEL); + wq->rq = kcalloc(depth, sizeof(*wq->rq), GFP_KERNEL); if (!wq->rq) goto err1; @@ -289,7 +289,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain, if (!wq->rq_addr) goto err2; - wq->sq = kzalloc(depth * sizeof(struct t3_swsq), GFP_KERNEL); + wq->sq = kcalloc(depth, sizeof(*wq->sq), GFP_KERNEL); if (!wq->sq) goto err3; -- 2.11.1