Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1361118
| Path | csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Steven Rostedt <rostedt@goodmis.org> |
| Newsgroups | linux.kernel |
| Subject | [for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs() |
| Date | Sat, 19 Mar 2016 15:20:02 +0100 |
| Message-ID | <repTs-VC-23@gated-at.bofh.it> (permalink) |
| References | <repTr-VC-5@gated-at.bofh.it> |
| X-Original-To | linux-kernel@vger.kernel.org |
| User-Agent | quilt/0.61-1 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-15 |
| Content-Disposition | inline; filename=0003-ftrace-Use-kasprintf-in-ftrace_profile_tracefs.patch |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 37 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Ingo Molnar <mingo@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Namhyung Kim <namhyung@kernel.org>, Geliang Tang <geliangtang@163.com> |
| X-Original-Date | Sat, 19 Mar 2016 10:15:19 -0400 |
| X-Original-Message-ID | <20160319141536.473708210@goodmis.org> |
| X-Original-References | <20160319141516.683762867@goodmis.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1361118 |
Show key headers only | View raw
From: Geliang Tang <geliangtang@163.com>
Use kasprintf() instead of kmalloc() and snprintf().
Link: http://lkml.kernel.org/r/135a7bc36e51fd9eaa57124dd2140285b771f738.1458050835.git.geliangtang@163.com
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/ftrace.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index d3850cbb840f..6a93faafbea4 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1030,8 +1030,7 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
for_each_possible_cpu(cpu) {
stat = &per_cpu(ftrace_profile_stats, cpu);
- /* allocate enough for function name + cpu number */
- name = kmalloc(32, GFP_KERNEL);
+ name = kasprintf(GFP_KERNEL, "function%d", cpu);
if (!name) {
/*
* The files created are permanent, if something happens
@@ -1043,7 +1042,6 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
return;
}
stat->stat = function_stats;
- snprintf(name, 32, "function%d", cpu);
stat->stat.name = name;
ret = register_stat_tracer(&stat->stat);
if (ret) {
--
2.7.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[for-next][PATCH 3/8] ftrace: Use kasprintf() in ftrace_profile_tracefs() Steven Rostedt <rostedt@goodmis.org> - 2016-03-19 15:20 +0100
csiph-web