Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967185AbcJFJIW (ORCPT ); Thu, 6 Oct 2016 05:08:22 -0400 Received: from mout.web.de ([212.227.15.4]:55663 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966974AbcJFJIT (ORCPT ); Thu, 6 Oct 2016 05:08:19 -0400 Subject: [PATCH 12/54] md/raid1: Use kcalloc() in setup_conf() 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: <1d9f7914-b224-9329-d132-ae4c07d3b512@users.sourceforge.net> Date: Thu, 6 Oct 2016 11:07:45 +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:bfrFIlcRuKjlRS4Rlk/fLSIuxFfke9IpepmiVbD3ELQc2OqyDGj 8g/XpUqJxRWPAnVgAlH7/vyzb9un4BF6GV/XMtKRV0J+g6Ttkf38nPdq8PeIhmHIQQB7HCH Ud0G4+RgN0b5Oqm8e9omsYZrJBTangmQvr6pUxysChcBLLk2QaXr1SFu0LaEsePgUE8gd/m qyryox83WzBR68nTv+UaA== X-UI-Out-Filterresults: notjunk:1;V01:K0:oBeO9LlnPaI=:imDDRDlnET+Uzo3HnliOpn S7WkPeGKvzBYsL5iqAPWxmYKaB9JW9k8zfhhLFvInbp9Em9mW/BVSerkOVUN/2KZnMhBHSL1j 78zn9KJtsWgILsMZGjW1cWQSMKKxXJ4STKTbuzLr+AtjnH9zneUqflTiEyCRpUErBPzuK2xQf JyU8kg6KLDD0EYLLNjFq2lw4eH5cQIrhtYHdJOFYZEkA1mtz/ZRVuok2b9CvJzB2wOJQKfY8t oWLGvpaBqSd2PFK+B20+JqeHAC3KnL3jBgvSv4HzM4z9QcpgjpAgfUIHm1usdfzDk2kl8J45r FINHk/cHZdNwIyvjxhqzo6+yrksG8UzFh3t2nVhAQS9LPHUNu7J+5iLQ4ftgz/+HVD26yahP9 2n1im+gmDbyWqmW3/tf5k4qWAQDs6MiCDCaeVYlRtQUfP00oGeWlAyUcw49xrcpQQMcTCwX2Y FAyifsqG+wAJFD7STdGVQRae7WHWimdP2UXb2K3inuT1tN8his075OcEzS1Vhc89hsFzwRbXP eXp7keDuNqbgPQvg4knt1AsuIrRfSDrj6uUuSua0l1UjOMlj1jGRRcNP7PdGmUJWwrlWkWjgF qB0hu9xOWimkg5/CNO+Ll4TaYCk3iX2jCU33pqiBjwVQ1HuScJFb8rsqnf36E4KhoeExFU6LC dJea3SwUPDXmJEnXp5Zs8VTPW+L9DjqvapUALPgm5aWZvVVdjFoj2HA7+ZAK5x022xJGg5flt UrTsqcbFNjWVmkiR60uwkJqXbwSOyEjkLJOtbf+s4MJ2WNGrSJbYEVMU/mQJ9J0lSw0rD3Y0E 9qHpafG Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1088 Lines: 35 From: Markus Elfring Date: Tue, 4 Oct 2016 15:30:28 +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". * 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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index e75ae87..5969711 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2781,9 +2781,9 @@ static struct r1conf *setup_conf(struct mddev *mddev) if (!conf) goto abort; - conf->mirrors = kzalloc(sizeof(struct raid1_info) - * mddev->raid_disks * 2, - GFP_KERNEL); + conf->mirrors = kcalloc(mddev->raid_disks * 2, + sizeof(*conf->mirrors), + GFP_KERNEL); if (!conf->mirrors) goto abort; -- 2.10.1