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

From: SF Markus Elfring
Date: Sat May 13 2017 - 12:33:50 EST


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