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


Groups > linux.kernel > #1635269

[PATCH 5/6] lockdep: Improve a size determination in lock_stat_open()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 5/6] lockdep: Improve a size determination in lock_stat_open()
Date 2017-05-03 22:50 +0200
Message-ID <tD9nH-1VW-11@gated-at.bofh.it> (permalink)
References <tD9e2-1So-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 3 May 2017 22:05:57 +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>
---
 kernel/locking/lockdep_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 2cc0ccd2b3de..509a17f5ea01 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -607,7 +607,7 @@ static int lock_stat_open(struct inode *inode, struct file *file)
 {
 	int res;
 	struct lock_class *class;
-	struct lock_stat_seq *data = vmalloc(sizeof(struct lock_stat_seq));
+	struct lock_stat_seq *data = vmalloc(sizeof(*data));
 
 	if (!data)
 		return -ENOMEM;
-- 
2.12.2

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


Thread

[PATCH 0/6] lockdep: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:40 +0200
  [PATCH 2/6] lockdep: Use seq_putc() in seq_header() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:40 +0200
  [PATCH 4/6] lockdep: Combine two seq_printf() calls into one call in  l_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
  [PATCH 5/6] lockdep: Improve a size determination in lock_stat_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
  [PATCH 6/6] lockdep: Add spaces for better code readability SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200
  [PATCH 3/6] lockdep: Replace four seq_printf() calls by seq_puts() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-03 22:50 +0200

csiph-web