[PATCH 1/2] oprofile_perf: Improve a size determination in oprofile_perf_init()

SF Markus Elfring <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.oprofile,gmane.linux.kernel.janitors
Message-ID <[email protected]>
From: Markus Elfring <[email protected]>
Date: Sat, 13 May 2017 18:00:13 +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 <[email protected]>
---
 drivers/oprofile/oprofile_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index d5b2732b1b81..033f2c26f2ad 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -285,7 +285,6 @@ int __init oprofile_perf_init(struct oprofile_operations *ops)
 		goto out;
 	}
 
-	counter_config = kcalloc(num_counters,
-			sizeof(struct op_counter_config), GFP_KERNEL);
-
+	counter_config = kcalloc(num_counters, sizeof(*counter_config),
+				 GFP_KERNEL);
 	if (!counter_config) {
-- 
2.12.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.