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


Groups > linux.kernel > #1636849

[PATCH 03/10] dlm: Improve a size determination in table_seq_start()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 03/10] dlm: Improve a size determination in table_seq_start()
Date 2017-05-06 10:40 +0200
Message-ID <tE3pT-5Jf-3@gated-at.bofh.it> (permalink)
References <tE3pT-5Jf-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 6 May 2017 08:34:27 +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>
---
 fs/dlm/debug_fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 551e0f8dbe0d..fa08448e35dd 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -435,7 +435,7 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
 	if (bucket >= ls->ls_rsbtbl_size)
 		return NULL;
 
-	ri = kzalloc(sizeof(struct rsbtbl_iter), GFP_NOFS);
+	ri = kzalloc(sizeof(*ri), GFP_NOFS);
 	if (!ri)
 		return NULL;
 	if (n == 0)
-- 
2.12.2

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


Thread

[PATCH 00/10] fs-DLM: Fine-tuning for several function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:40 +0200
  [PATCH 03/10] dlm: Improve a size determination in table_seq_start() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:40 +0200
  [PATCH 01/10] dlm: Replace six seq_puts() calls by seq_putc() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:40 +0200
  [PATCH 02/10] dlm: Add spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:40 +0200
  [PATCH 05/10] dlm: Improve a size determination in  dlm_recover_waiters_pre() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  [PATCH 04/10] dlm: Use kcalloc() in dlm_scan_waiters() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  [PATCH 09/10] dlm: Improve a size determination in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  [PATCH 08/10] dlm: Use kcalloc() in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  [PATCH 06/10] dlm: Delete an error message for a failed memory  allocation in dlm_recover_waiters_pre() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  [PATCH 10/10] dlm: Delete an unnecessary variable initialisation in  dlm_ls_start() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  [PATCH 07/10] dlm: Use kmalloc_array() in make_member_array() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-06 10:50 +0200
  Re: [Cluster-devel] [PATCH 00/10] fs-DLM: Fine-tuning for several  function implementations Bob Peterson <rpeterso@redhat.com> - 2017-05-08 22:10 +0200

csiph-web