Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932672AbcCROcB (ORCPT ); Fri, 18 Mar 2016 10:32:01 -0400 Received: from smtprelay0254.hostedemail.com ([216.40.44.254]:55087 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753933AbcCROb4 (ORCPT ); Fri, 18 Mar 2016 10:31:56 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3151:3352:3622:3865:3866:3868:4362:5007:6261:7875:9040:10004:10400:10848:10967:11026:11232:11658:11914:12043:12114:12438:12517:12519:12555:12740:13069:13311:13357:13439:13972:14096:14097:14659:14721:21080:30029:30034:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:8,LUA_SUMMARY:none X-HE-Tag: blood52_4abd0d5c6bb4c X-Filterd-Recvd-Size: 2089 Date: Fri, 18 Mar 2016 10:31:52 -0400 From: Steven Rostedt To: Geliang Tang Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ftrace: use kasprintf() in ftrace_profile_tracefs() Message-ID: <20160318103152.746b7bf5@gandalf.local.home> In-Reply-To: <135a7bc36e51fd9eaa57124dd2140285b771f738.1458050835.git.geliangtang@163.com> References: <135a7bc36e51fd9eaa57124dd2140285b771f738.1458050835.git.geliangtang@163.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1160 Lines: 37 On Tue, 15 Mar 2016 22:12:34 +0800 Geliang Tang wrote: > Use kasprintf() instead of kmalloc() and snprintf(). > > Signed-off-by: Geliang Tang Thanks, applied! -- Steve > --- > 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 2ece9f1..69aceae 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) {