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

From: SF Markus Elfring
Date: Wed May 03 2017 - 16:41:31 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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