On Tue, 8 Jan 2019 17:00:11 +0200 Slavomir Kaslev <kaslevs@xxxxxxxxxx> 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@xxxxxxxxxx> FYI, I took this patch but changed the subject and description to this: From: Slavomir Kaslev <kaslevs@xxxxxxxxxx> 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@xxxxxxxxxx> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> -- Steve
![]() |