[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 6 Jun 2014 15:22:47 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: Andi Kleen <ak@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung.kim@....com>,
Adrian Hunter <adrian.hunter@...el.com>,
Stephane Eranian <eranian@...gle.com>,
David Ahern <dsahern@...il.com>,
Vince Weaver <vincent.weaver@...ne.edu>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tools: perf: util: parse-events.c: Cleaning up missing
null-terminate after strncpy call
On Fri, Jun 06, 2014 at 03:16:56PM +0200, Rickard Strandqvist wrote:
> Hi
>
> I really do not want to complicate things here, both work course here.
> But sptlcpy is definitely faster. But this is hardly time-critical
> code, so maybe it looks better to use snprintf in both cases.
>
> I vote for sptlcpy, but who decides?
> Someone decides and I submit another patch :-)
I vote for snprintf ;-)
jirka
>
> Best regards
> Rickard Strandqvist
>
>
> 2014-06-05 0:31 GMT+02:00 Andi Kleen <ak@...ux.intel.com>:
> > On Thu, Jun 05, 2014 at 12:23:55AM +0200, Rickard Strandqvist wrote:
> >> Hi
> >>
> >> A little embarrassing, but I actually did not know that there was a
> >> better replacement for strncpy.
> >
> > This works for perf, but not in general because standard glibc
> > does not have strlcpy. snprintf works always.
> >
> > In practice if you could tolerate strncpy always zeroing
> > the complete string before you can also tolerate snprintf.
> >
> > -Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists