Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751549AbcJBL52 (ORCPT ); Sun, 2 Oct 2016 07:57:28 -0400 Received: from mout.web.de ([212.227.15.4]:53311 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbcJBL5X (ORCPT ); Sun, 2 Oct 2016 07:57:23 -0400 Subject: [PATCH 1/13] md/multipath: Use kcalloc() in multipath_run() To: linux-raid@vger.kernel.org, Jens Axboe , NeilBrown , Shaohua Li References: <566ABCD9.1060404@users.sourceforge.net> <4a31d7a7-f70c-12f7-202f-963bd8706066@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <0383a635-6b6d-0e70-c3d5-99c05f2c72f7@users.sourceforge.net> Date: Sun, 2 Oct 2016 13:56:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <4a31d7a7-f70c-12f7-202f-963bd8706066@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:c5aWRtrzo6VrcmSVTqsSX/0ZINhZ1jnAKDeeGDZwT02OnstM2t9 40Tkna/CThvwa2hfFA4cUyRHShZBJ5Cq0WsFwYLIK7t620MXthqCC0CWi1F5HLBpEEVlBED OIHCwSF2cxfneURHRb3KZww1juKwg11vncChv0g+nvHLLfh+gZF+UMfqAdYfc8risRxGoRY lwm7OxKvSa8UHLWBR22Dw== X-UI-Out-Filterresults: notjunk:1;V01:K0:2oXUnlRySpg=:z9zYJAV7B74kp7uZJMrhJ3 IvJv5kzSdVpggDPTIKphKyXv2Y2n3q0kxmRl+wcTuIKE2AWZVDhtamvCt5M8yAa4j2HuezBhY D0va5HUJJbdvLN0Hp48feoxguGqAwdRzN+8VbJEdBd7qjqovj2aEfrRuG5kkkCTUgmSqODKwX zyYSMFKdsiffmtIVymla/D/7nmfoVZpPxD6m+KuvFhXHV0U2PbrrRUJtysCKcbZtXFvq4SBeE k7lJykXhdJLOPcvj9l+XaK4164w1AtEmF4OSHY24qbm+UFDX2FeA70oDZpA3GzhPnq2wdOGan ycs0n8CWxJwrHMKzKj4DWZgGhsN1oJzH5iLNG8iGctq9ZFI38FEBqoskWnAe2Cc94L1oE7oEt d8PlDKOPp+rljCP8Brr8/OjL1XoVQwQfPYLi5172oduwbZLLh1EkENETfKO6XUTnA8o8/JJFX e0QyiFBtcMI9nCLxnbr0uyHMtF7Cl8NUDCc2tr0jzRjAg6jCL1FPGtMhzKih5cO4UhUDVmYB/ yS+MiHRGq8UyH+gX2tdaUAU0cW0Z6zwULft/f4bQpxT8/fjT0lxQzhEUpD7bKCUna03mmezvn gFfovsa97XNe1x2ZNdGrwmgrkqFOOwFvGmSyF2K7EgWREE8ag3H+MAs/wu7rEVHYkkQY1ww7W +trmEDJMMQjZa6EDxA8St8iGstxY446IgqitGkuVbED7iLERVdg6N08xjB2YYvVCX5RK4gfdv p1nLYtX6VbH4NGigUybk/rfP9jMC4lXTk1Ghwpei4M2CJednOuuGU51s+DRJyOkvDCbDoLfaR JbxVNyL Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1139 Lines: 34 From: Markus Elfring Date: Sat, 1 Oct 2016 20:40:42 +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. * Replace the specification of a data structure 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/md/multipath.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 673efbd..bd53451 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -408,7 +408,8 @@ static int multipath_run (struct mddev *mddev) goto out; } - conf->multipaths = kzalloc(sizeof(struct multipath_info)*mddev->raid_disks, + conf->multipaths = kcalloc(mddev->raid_disks, + sizeof(*conf->multipaths), GFP_KERNEL); if (!conf->multipaths) { printk(KERN_ERR -- 2.10.0