Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967225AbcJFJFe (ORCPT ); Thu, 6 Oct 2016 05:05:34 -0400 Received: from mout.web.de ([212.227.17.12]:58773 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966338AbcJFJFc (ORCPT ); Thu, 6 Oct 2016 05:05:32 -0400 Subject: [PATCH 10/54] md/raid1: Use kcalloc() in alloc_behind_pages() To: linux-raid@vger.kernel.org, Christoph Hellwig , Guoqing Jiang , Jens Axboe , Mike Christie , Neil Brown , Shaohua Li , Tomasz Majchrzak References: <566ABCD9.1060404@users.sourceforge.net> <786843ef-4b6f-eb04-7326-2f6f5b408826@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <22c0aa38-d45a-0691-a2a0-9c57f5837844@users.sourceforge.net> Date: Thu, 6 Oct 2016 11:05:07 +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: <786843ef-4b6f-eb04-7326-2f6f5b408826@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:iGWLDR+/JZI7D8JOY2Gf3tT4mpz5UhYWwLJbq9qGYcTNElaX6OP 5doN0nHmjbdKbq07pnR10+Spdgn7CqrcNEsQFkS03cyYHJHD4v0nIP+KuzV4TzOHp2d/dnU rAMyvLAcB8Jyt7fCcrxUc2OxgPRpATSu1E415cceLDkSl+hsZJ5g8rzpDir4QIRx7mqsIk1 5qPyzBJOEWQSJ/SNdQIbA== X-UI-Out-Filterresults: notjunk:1;V01:K0:/OnRCBYg7G0=:Eqqz9DTew3zq2DlkieZu7F nfK+iq4U+ZhSGc+41w553oTgcU5H0pTlDUj+2VBd2CVBAgT3JaUYJuQlnXPbeNrOUJfuRjwzz v5xZctWPanwdfyh9qWQwrhAMgeWMKgIBtkrxTNN/pz8M2cxyOQ7IpOfY3+khZ23sIzpsZ51Yo B/F3ulqDQxtbUo6tWnKrE1bOi5DIfH6b/Lqc4s8Lu86mrQU2tv44cIlPaJipYgMvoN70tv3Nv Wvrvo03Z1yGwYO17rWxA2k/m+KgqBJAstn1HVblk1RhJ3IihneSHJzMxb6aQUbeReee/z2eV3 z4vfpze32piAK1O0CtD5VfoMxJq6nUpf047mKYIAfPPhltzg/oaJDkuKwr7aKNDXXMUm3cZ5N cL8wQZVuJvuTMEFa3N+ZLAqKmWxGm3VzUytQOpQF2+E5o4Rq7Bn2bShpJ8U7stWrB/Mi2QXvj b7AH5zNkcq+/MowJ9DbB45zHEPe1FdjZkLRK5RAW8dKLp9C52SstHvY1RYUGt5dy/YEQ51aMr SuNvawqi8sIT4kLGP2uZpSe5f4jEutdVsz1tD/c+zaEpFJTOPwddIyhPlG1aop5GTeUko0r+/ 1LAuz6+PLX/apKFd835E4vM470DFq29Gd/AEQugY0TJIo3IHw5eu29+aYzmXhe6durUTiO2d/ qdWqyPc9F60nUGd0N7wcTdCJAtaRLiRsuWAuBNiw2P7j0Xn7cknSaqJaB50tRcFNYaNKyrjaw Wu15lCwxAsRrqNkvq5D9TfiAVCRaZj0L8I0pMDosbSVwoIpNCKbtW8U1McUP9sEtU0EG+9E4f /miyisN Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1131 Lines: 34 From: Markus Elfring Date: Tue, 4 Oct 2016 15:01:04 +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. * 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/raid1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 1961d82..d2759f8 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -955,8 +955,7 @@ static void alloc_behind_pages(struct bio *bio, struct r1bio *r1_bio) { int i; struct bio_vec *bvec; - struct bio_vec *bvecs = kzalloc(bio->bi_vcnt * sizeof(struct bio_vec), - GFP_NOIO); + struct bio_vec *bvecs = kcalloc(bio->bi_vcnt, sizeof(*bvecs), GFP_NOIO); if (unlikely(!bvecs)) return; -- 2.10.1