mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: oprofile-list@lists.sf.net, Robert Richter <rric@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/2] oprofile_perf: Improve a size determination in oprofile_perf_init()
Date: Sat, 13 May 2017 18:33:42 +0200	[thread overview]
Message-ID: <0fc2061c-a358-b158-898f-5aa6325cfe02@users.sourceforge.net> (raw)
In-Reply-To: <8e408a15-7884-e9a1-0df2-a7419987c450@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
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@users.sourceforge.net>
---
 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

  reply	other threads:[~2017-05-13 16:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-13 16:32 [PATCH 0/2] oprofile_perf: Adjustments for oprofile_perf_init() SF Markus Elfring
2017-05-13 16:33 ` SF Markus Elfring [this message]
2017-05-13 16:35 ` [PATCH 2/2] oprofile_perf: Delete error messages for a failed memory allocation in oprofile_perf_init() SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fc2061c-a358-b158-898f-5aa6325cfe02@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oprofile-list@lists.sf.net \
    --cc=rric@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome