From: Steven Rostedt <rostedt@goodmis.org>
To: Slavomir Kaslev <kaslevs@vmware.com>
Cc: linux-trace-devel@vger.kernel.org, ykaradzhov@vmware.com,
tstoyanov@vmware.com
Subject: Re: [PATCH v2 2/6] trace-cmd: Fix warnings reported by gcc 8.2
Date: Tue, 8 Jan 2019 17:32:16 -0500 [thread overview]
Message-ID: <20190108173216.0e89bdd9@gandalf.local.home> (raw)
In-Reply-To: <20190108150015.21327-3-kaslevs@vmware.com>
On Tue, 8 Jan 2019 17:00:11 +0200
Slavomir Kaslev <kaslevs@vmware.com> wrote:
> Compiling trace-cmd with gcc 8.2 reports:
>
> trace-read.c: In function ‘append_pid_filter’:
> trace-read.c:414:3: warning: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Wrestrict]
> sprintf(filter, "%s||" FILTER_FMT, filter, pid, pid, pid);
> ^~~~~~~
>
> since `snprintf` declares its first argument as __restrict but `buf` is also
> passed as argument #5.
>
> Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
FYI, I took this patch but changed the subject and description to this:
From: Slavomir Kaslev <kaslevs@vmware.com>
Subject: [PATCH] trace-cmd: Do not use target string pointer as parameter to
sprintf()
Compiling trace-cmd with gcc 8.2 reports:
trace-read.c: In function ‘append_pid_filter’:
trace-read.c:414:3: warning: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Wrestrict]
sprintf(filter, "%s||" FILTER_FMT, filter, pid, pid, pid);
^~~~~~~
since `snprintf` declares its first argument as __restrict but `buf` is also
passed as argument #5.
The code just concatenates to the filter string. Use the original string
length as the position to write to filter.
Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-- Steve
next prev parent reply other threads:[~2019-01-08 22:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-08 15:00 [PATCH v2 0/6] Add VM guest kernel tracing using vsock sockets for transport Slavomir Kaslev
2019-01-08 15:00 ` [PATCH v2 1/6] trace-cmd: Fix indentation Slavomir Kaslev
2019-01-08 15:00 ` [PATCH v2 2/6] trace-cmd: Fix warnings reported by gcc 8.2 Slavomir Kaslev
2019-01-08 22:32 ` Steven Rostedt [this message]
2019-01-08 15:00 ` [PATCH v2 3/6] trace-cmd: Add tracecmd_create_recorder_virt function Slavomir Kaslev
2019-01-08 15:00 ` [PATCH v2 4/6] trace-cmd: Simplify and fix memory leaks in tracecmd_msg_collect_data Slavomir Kaslev
2019-01-08 22:40 ` Steven Rostedt
2019-01-08 15:00 ` [PATCH v2 5/6] trace-cmd: Add TRACE_REQ and TRACE_RESP messages Slavomir Kaslev
2019-01-08 23:01 ` Steven Rostedt
2019-01-08 15:00 ` [PATCH v2 6/6] trace-cmd: Add VM kernel tracing using vsock socket for transport Slavomir Kaslev
2019-01-09 21:20 ` [PATCH v2 0/6] Add VM guest kernel tracing using vsock sockets " 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=20190108173216.0e89bdd9@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=kaslevs@vmware.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tstoyanov@vmware.com \
--cc=ykaradzhov@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).