Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1494425

[PATCH 09/15] md-cluster: Improve another size determination in lockres_init()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 09/15] md-cluster: Improve another size determination in lockres_init()
Date 2016-10-01 17:00 +0200
Message-ID <sntVG-1vj-85@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <sntM1-1qz-135@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 1 Oct 2016 13:02:18 +0200

Replace the specification of a data structure by a pointer dereference
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/md/md-cluster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 0918108..bec8035 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -190,7 +190,7 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
 	int ret, namelen;
 	struct md_cluster_info *cinfo = mddev->cluster_info;
 
-	res = kzalloc(sizeof(struct dlm_lock_resource), GFP_KERNEL);
+	res = kzalloc(sizeof(*res), GFP_KERNEL);
 	if (!res)
 		return NULL;
 	init_waitqueue_head(&res->sync_locking);
-- 
2.10.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/15] md-cluster: Fine-tuning for ten function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 16:50 +0200
  [PATCH 01/15] md-cluster: Use kcalloc() in lock_all_bitmaps() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 16:50 +0200
  [PATCH 04/15] md-cluster: Improve another size determination in  __sendmsg() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 16:50 +0200
  [PATCH 02/15] md-cluster: Improve another size determination in  resync_info_update() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 16:50 +0200
  [PATCH 03/15] md-cluster: Improve another size determination in  join() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 16:50 +0200
  [PATCH 10/15] md-cluster: Delete an unnecessary variable  initialisation in lockres_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 12/15] md-cluster: Rename a jump label in area_resyncing() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 13/15] md-cluster: Less function calls in join() after error  detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
    [PATCH v2 13/15] md-cluster: Less function calls in join() after  error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-06 17:20 +0200
  [PATCH 05/15] md-cluster: Improve another size determination in  recv_daemon() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 07/15] md-cluster: Improve another size determination in  process_suspend_info() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 14/15] md-cluster: Less function calls in lockres_init() after  error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 11/15] md-cluster: Delete four error messages for a failed  memory allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 08/15] md-cluster: Improve determination of sizes in  read_resync_info() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 09/15] md-cluster: Improve another size determination in  lockres_init() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 06/15] md-cluster: Rename a jump label in recv_daemon() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:00 +0200
  [PATCH 15/15] md-cluster: Delete unnecessary braces in  unlock_all_bitmaps() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-01 17:10 +0200
    Re: [PATCH 15/15] md-cluster: Delete unnecessary braces in  unlock_all_bitmaps() Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-07 09:50 +0200
      Re: md-cluster: Delete unnecessary braces in unlock_all_bitmaps() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-10-07 10:40 +0200
        Re: md-cluster: Delete unnecessary braces in unlock_all_bitmaps() walter harms <wharms@bfs.de> - 2016-10-07 15:30 +0200

csiph-web