From: Jiri Olsa <jolsa@redhat.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Andi Kleen <ak@linux.intel.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung.kim@lge.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Stephane Eranian <eranian@google.com>,
David Ahern <dsahern@gmail.com>,
Vince Weaver <vincent.weaver@maine.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tools: perf: util: parse-events.c: Cleaning up missing null-terminate after strncpy call
Date: Fri, 6 Jun 2014 15:22:47 +0200 [thread overview]
Message-ID: <20140606132247.GA1110@krava.brq.redhat.com> (raw)
In-Reply-To: <CAFo99gb4+_nn-5PonfgNfXfyB9PdqsiWX=VqgSxRUtP3oOhD9Q@mail.gmail.com>
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@linux.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
prev parent reply other threads:[~2014-06-06 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 21:46 Rickard Strandqvist
2014-06-04 22:20 ` Andi Kleen
2014-06-04 22:23 ` Rickard Strandqvist
2014-06-04 22:31 ` Andi Kleen
2014-06-06 13:16 ` Rickard Strandqvist
2014-06-06 13:22 ` Jiri Olsa [this message]
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=20140606132247.GA1110@krava.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.org \
--cc=rickard_strandqvist@spectrumdigital.se \
--cc=vincent.weaver@maine.edu \
/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