1
0
Fork 0
remarkable-linux/tools
Jiri Olsa d0c9f9f9fb perf tools: Fix snprint warnings for gcc 8
commit 77f18153c0 upstream.

With gcc 8 we get new set of snprintf() warnings that breaks the
compilation, one example:

  tests/mem.c: In function ‘check’:
  tests/mem.c:19:48: error: ‘%s’ directive output may be truncated writing \
        up to 99 bytes into a region of size 89 [-Werror=format-truncation=]
    snprintf(failure, sizeof failure, "unexpected %s", out);

The gcc docs says:

 To avoid the warning either use a bigger buffer or handle the
 function's return value which indicates whether or not its output
 has been truncated.

Given that all these warnings are harmless, because the code either
properly fails due to uncomplete file path or we don't care for
truncated output at all, I'm changing all those snprintf() calls to
scnprintf(), which actually 'checks' for the snprint return value so the
gcc stays silent.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Link: http://lkml.kernel.org/r/20180319082902.4518-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ignat Korchagin <ignat@cloudflare.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-18 09:16:28 +02:00
..
accounting License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
arch tools headers: Synchronise x86 cpufeatures.h for L1TF additions 2018-08-15 18:13:01 +02:00
build tools: build: Use HOSTLDFLAGS with fixdep 2018-08-24 13:09:17 +02:00
cgroup License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
firewire License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
gpio tools/gpio: Fix build error with musl libc 2018-02-03 17:38:47 +01:00
hv tools: hv: fcopy: set 'error' in case an unknown operation was requested 2018-10-10 08:54:28 +02:00
iio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
include tools: sync up .h files with the repective arch and uapi .h files 2018-05-30 12:19:59 +02:00
kvm/kvm_stat tools/kvm_stat: fix handling of invalid paths in debugfs provider 2018-10-10 08:54:20 +02:00
laptop License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
leds License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
lib tools/lib/subcmd/pager.c: do not alias select() params 2018-05-01 12:58:25 -07:00
net bpf: fix uninitialized variable in bpf tools 2018-06-21 04:02:49 +09:00
nfsd License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
objtool objtool: Support GCC 8 '-fnoreorder-functions' 2018-08-24 13:09:11 +02:00
pci License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pcmcia License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf perf tools: Fix snprint warnings for gcc 8 2018-10-18 09:16:28 +02:00
power tools/power turbostat: fix possible sprintf buffer overflow 2018-10-10 08:54:18 +02:00
scripts Kbuild: fix # escaping in .cmd files for future Make 2018-07-11 16:29:21 +02:00
spi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
testing selftests: memory-hotplug: add required configs 2018-10-18 09:16:21 +02:00
thermal/tmon tools/thermal: tmon: fix for segfault 2018-05-30 07:52:28 +02:00
time
usb tools: usb: ffs-test: Fix build on big endian systems 2018-09-05 09:26:26 +02:00
virtio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vm tools/vm/page-types.c: fix "defined but not used" warning 2018-10-10 08:54:22 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00