From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra13.linbit.com (zimbra.linbit.com [212.69.161.123]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTPS id 379F5105646D for ; Mon, 12 Sep 2016 15:11:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra13.linbit.com (Postfix) with ESMTP id 2419A2EBE29 for ; Mon, 12 Sep 2016 15:11:51 +0200 (CEST) Received: from zimbra13.linbit.com ([127.0.0.1]) by localhost (zimbra13.linbit.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id otOkXqzEDm1v for ; Mon, 12 Sep 2016 15:11:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra13.linbit.com (Postfix) with ESMTP id ECC422EBE2B for ; Mon, 12 Sep 2016 15:11:50 +0200 (CEST) Received: from zimbra13.linbit.com ([127.0.0.1]) by localhost (zimbra13.linbit.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id HkD_WzHHhkVy for ; Mon, 12 Sep 2016 15:11:50 +0200 (CEST) Received: from soda.linbit (tuerlsteher.linbit.com [86.59.100.100]) by zimbra13.linbit.com (Postfix) with ESMTPS id B93102EBE29 for ; Mon, 12 Sep 2016 15:11:50 +0200 (CEST) Resent-Message-ID: <20160912131150.GB14595@soda.linbit> Received: from mout.web.de (mout.web.de [217.72.192.78]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTPS id A0777105646A for ; Sat, 10 Sep 2016 22:27:23 +0200 (CEST) To: drbd-dev@lists.linbit.com, Lars Ellenberg , Philipp Reisner References: <3566e764-27b8-82e5-1f8e-c613e5a3a5b1@users.sourceforge.net> From: SF Markus Elfring Message-ID: <52dd5e61-96c1-e309-7a43-20768b05dd24@users.sourceforge.net> Date: Sat, 10 Sep 2016 22:22:07 +0200 MIME-Version: 1.0 In-Reply-To: <3566e764-27b8-82e5-1f8e-c613e5a3a5b1@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Subject: [Drbd-dev] [PATCH 01/13] DRBD-receiver: Use kmalloc_array() in receive_uuids() List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Markus Elfring Date: Sat, 10 Sep 2016 19:22:57 +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 "kmalloc_array". This issue was detected by using the Coccinelle software. * Replace the specification of a data type 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/block/drbd/drbd_receiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 942384f..3be9fbf 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -4186,7 +4186,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info return config_unknown_volume(connection, pi); device = peer_device->device; - p_uuid = kmalloc(sizeof(u64)*UI_EXTENDED_SIZE, GFP_NOIO); + p_uuid = kmalloc_array(UI_EXTENDED_SIZE, sizeof(*p_uuid), GFP_NOIO); if (!p_uuid) { drbd_err(device, "kmalloc of p_uuid failed\n"); return false; -- 2.10.0