linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Slavomir Kaslev <kaslevs@vmware.com>
Cc: "linux-trace-devel@vger.kernel.org"
	<linux-trace-devel@vger.kernel.org>,
	Tzvetomir Stoyanov <tstoyanov@vmware.com>
Subject: Re: [PATCH] trace-cmd: Fix warnings reported by gcc 8.2
Date: Tue, 27 Nov 2018 08:58:54 -0500	[thread overview]
Message-ID: <20181127085854.33e36363@gandalf.local.home> (raw)
In-Reply-To: <CAE0o1NtKC5nvwuFZs=iz=UHce6ASQk7JECfdNNqzq8hLeN+Qiw@mail.gmail.com>

On Tue, 27 Nov 2018 10:43:17 +0000
Slavomir Kaslev <kaslevs@vmware.com> wrote:

> Ping.

Thanks for the reminder.

> On Wed, Nov 14, 2018 at 5:43 PM <kaslevs@vmware.com> wrote:
> >
> > From: Slavomir Kaslev <kaslevs@vmware.com>
> >
> > Compiling trace-cmd with gcc 8.2 reports:
> >
> >     str_error_r.c: In function ‘str_error_r’:
> >     str_error_r.c:24:3: warning: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Wrestrict]
> >        snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
> >        ^~~~~~~~
> >
> > since `snprintf` declares its first argument as __restrict but `buf` is also
> > passed as argument #5.

Ah, this is fixed in the Linux kernel tree.

Tzvetomir, can you back port commit 854e55ad289 ("objtool, perf: Fix
GCC 8 -Wrestrict error") from Linux to trace-cmd?

Thanks!

-- Steve


> >
> > Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
> > ---
> >  lib/traceevent/str_error_r.c | 2 +-
> >  tracecmd/trace-read.c        | 8 ++++----
> >  2 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/lib/traceevent/str_error_r.c b/lib/traceevent/str_error_r.c
> > index 503ae07..53c7206 100644
> > --- a/lib/traceevent/str_error_r.c
> > +++ b/lib/traceevent/str_error_r.c
> > @@ -21,6 +21,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen)
> >  {
> >         int err = strerror_r(errnum, buf, buflen);
> >         if (err)
> > -               snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
> > +               snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d)=%d", errnum, err);
> >         return buf;
> >  }
> > diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
> > index c406d66..1f91fff 100644
> > --- a/tracecmd/trace-read.c
> > +++ b/tracecmd/trace-read.c
> > @@ -386,7 +386,7 @@ static void add_pid_filter(const char *arg)
> >  static char *append_pid_filter(char *curr_filter, char *pid)
> >  {
> >         char *filter;
> > -       int len;
> > +       int len, curr_len;
> >
> >  #define FILTER_FMT "(common_pid==" __STR ")||(pid==" __STR ")||(next_pid==" __STR ")"
> >
> > @@ -405,13 +405,13 @@ static char *append_pid_filter(char *curr_filter, char *pid)
> >                         die("Failed to allocate for filter %s", curr_filter);
> >                 sprintf(filter, ".*:" FILTER_FMT, pid, pid, pid);
> >         } else {
> > -
> > -               len += strlen(curr_filter);
> > +               curr_len = strlen(curr_filter);
> > +               len += curr_len;
> >
> >                 filter = realloc(curr_filter, len);
> >                 if (!filter)
> >                         die("realloc");
> > -               sprintf(filter, "%s||" FILTER_FMT, filter, pid, pid, pid);
> > +               sprintf(filter + curr_len, "||" FILTER_FMT, pid, pid, pid);
> >         }
> >
> >         return filter;
> > --
> > 2.19.1
> >  

      reply	other threads:[~2018-11-28  0:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 15:43 [PATCH] trace-cmd: Fix warnings reported by gcc 8.2 kaslevs
2018-11-27 10:43 ` Slavomir Kaslev
2018-11-27 13:58   ` Steven Rostedt [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=20181127085854.33e36363@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=kaslevs@vmware.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tstoyanov@vmware.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;
as well as URLs for NNTP newsgroup(s).