From: Steven Rostedt <rostedt@goodmis.org>
To: Nick Desaulniers <nick.desaulniers@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
ebiggers@google.com
Subject: Re: [PATCH] tracing: prefer strlcpy to strncpy
Date: Mon, 4 Jun 2018 14:10:03 -0400 [thread overview]
Message-ID: <20180604141003.3b3d507b@gandalf.local.home> (raw)
In-Reply-To: <CAH7mPvh_T1YzfGBR+mzcwQ5r6bhz2NxrvY5r7sSY=wMeh-GK+w@mail.gmail.com>
On Tue, 29 May 2018 18:55:23 -0700
Nick Desaulniers <nick.desaulniers@gmail.com> wrote:
> On Mon, May 28, 2018 at 11:03 PM, Nick Desaulniers
> <nick.desaulniers@gmail.com> wrote:
> > Fixes a stringop-truncation warning from gcc-8.
> >
> > Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> > ---
> > kernel/trace/trace_events_hist.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> > index b9061ed..b53a6c0 100644
> > --- a/kernel/trace/trace_events_hist.c
> > +++ b/kernel/trace/trace_events_hist.c
> > @@ -393,7 +393,7 @@ static void hist_err_event(char *str, char *system, char *event, char *var)
> > else if (system)
> > snprintf(err, MAX_FILTER_STR_VAL, "%s.%s", system, event);
> > else
> > - strncpy(err, var, MAX_FILTER_STR_VAL);
> > + strlcpy(err, var, MAX_FILTER_STR_VAL);
> >
> > hist_err(str, err);
> > }
> > --
> > 2.7.4
> >
>
> Eric points out this wont initialize the rest of err with zeros.
And why do we care?
-- Steve
next prev parent reply other threads:[~2018-06-04 18:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 6:03 Nick Desaulniers
2018-05-30 1:55 ` Nick Desaulniers
2018-06-04 18:10 ` Steven Rostedt [this message]
2018-06-04 18:06 ` Steven Rostedt
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=20180604141003.3b3d507b@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=ebiggers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nick.desaulniers@gmail.com \
/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
all inboxes | Powered by JetHome®