public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: drbd-dev@lists.linbit.com,
	Lars Ellenberg <lars.ellenberg@linbit.com>,
	Philipp Reisner <philipp.reisner@linbit.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	Julia Lawall <julia.lawall@lip6.fr>
Subject: [PATCH 09/13] DRBD-receiver: Improve determination of sizes in receive_SyncParam()
Date: Sat, 10 Sep 2016 22:32:17 +0200	[thread overview]
Message-ID: <334ae3df-8fff-025b-5311-af4522d9611f@users.sourceforge.net> (raw)
In-Reply-To: <3566e764-27b8-82e5-1f8e-c613e5a3a5b1@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 10 Sep 2016 21:54:55 +0200

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/block/drbd/drbd_receiver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 2fe58d1..6fbd968 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3859,7 +3859,7 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
 	mutex_lock(&connection->resource->conf_update);
 	old_net_conf = peer_device->connection->net_conf;
 	if (get_ldev(device)) {
-		new_disk_conf = kzalloc(sizeof(struct disk_conf), GFP_KERNEL);
+		new_disk_conf = kzalloc(sizeof(*new_disk_conf), GFP_KERNEL);
 		if (!new_disk_conf) {
 			put_ldev(device);
 			mutex_unlock(&connection->resource->conf_update);
@@ -3946,7 +3946,8 @@ static int receive_SyncParam(struct drbd_connection *connection, struct packet_i
 		}
 
 		if (verify_tfm || csums_tfm) {
-			new_net_conf = kzalloc(sizeof(struct net_conf), GFP_KERNEL);
+			new_net_conf = kzalloc(sizeof(*new_net_conf),
+					       GFP_KERNEL);
 			if (!new_net_conf) {
 				drbd_err(device, "Allocation of new net_conf failed\n");
 				goto disconnect;
-- 
2.10.0

  parent reply	other threads:[~2016-09-10 20:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-10 20:20 [PATCH 00/13] DRBD-receiver: Fine-tuning for six function implementations SF Markus Elfring
2016-09-10 20:22 ` [PATCH 01/13] DRBD-receiver: Use kmalloc_array() in receive_uuids() SF Markus Elfring
2016-09-10 20:23 ` [PATCH 02/13] DRBD-receiver: Delete an error message for a failed kmalloc_array() call SF Markus Elfring
2016-09-10 20:24 ` [PATCH 03/13] DRBD-receiver: Move an assignment in receive_uuids() SF Markus Elfring
2016-09-10 20:25 ` [PATCH 04/13] DRBD-receiver: Improve a size determination in drbd_do_features() SF Markus Elfring
2016-09-10 20:26 ` [PATCH 05/13] DRBD-receiver: Delete an unnecessary initialisation in receive_sizes() SF Markus Elfring
2016-09-10 20:28 ` [PATCH 06/13] DRBD-receiver: Improve a size determination " SF Markus Elfring
2016-09-10 20:30 ` [PATCH 07/13] DRBD-receiver: Delete an error message for a failed kzalloc() call " SF Markus Elfring
2016-09-10 20:31 ` [PATCH 08/13] DRBD-receiver: Move an assignment " SF Markus Elfring
2016-09-10 20:32 ` SF Markus Elfring [this message]
2016-09-10 20:33 ` [PATCH 10/13] DRBD-receiver: Delete error messages for failed resource allocations in receive_SyncParam() SF Markus Elfring
2016-09-10 20:34 ` [PATCH 11/13] DRBD-receiver: Improve a size determination in receive_protocol() SF Markus Elfring
2016-09-10 20:35 ` [PATCH 12/13] DRBD-receiver: Delete error messages for failed resource allocations " SF Markus Elfring
2016-09-10 20:36 ` [PATCH 13/13] DRBD-receiver: Improve determination of sizes in receive_Barrier() SF Markus Elfring
2017-08-06 10:18 ` [PATCH 00/13] DRBD-receiver: Fine-tuning for six function implementations SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=334ae3df-8fff-025b-5311-af4522d9611f@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=drbd-dev@lists.linbit.com \
    --cc=julia.lawall@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars.ellenberg@linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.reisner@linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox