lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADWwUUYe=3aZQwkg+v-XMrScVpmmT7i=1US4usQ6Vm+5Zdc+3A@mail.gmail.com>
Date:	Wed, 16 Mar 2016 23:19:08 +0900
From:	Namhyung Kim <namhyung@...il.com>
To:	Geliang Tang <geliangtang@....com>
Cc:	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ftrace: use kasprintf() in ftrace_profile_tracefs()

Hi Geliang,

On Tue, Mar 15, 2016 at 11:12 PM, Geliang Tang <geliangtang@....com> wrote:
> Use kasprintf() instead of kmalloc() and snprintf().
>
> Signed-off-by: Geliang Tang <geliangtang@....com>

Acked-by: Namhyung Kim <namhyung@...nel.org>

Thanks,
Namhyung


> ---
>  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) {
> --
> 2.5.0
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ