• Jiri Olsa's avatar
    perf tools: Fix snprint warnings for gcc 8 · d0c9f9f9
    Jiri Olsa authored
    commit 77f18153c080855e1c3fb520ca31a4e61530121d 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: 's avatarJiri 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.orgSigned-off-by: 's avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Ignat Korchagin <ignat@cloudflare.com>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    d0c9f9f9
Name
Last commit
Last update
..
accounting Loading commit data...
arch Loading commit data...
build Loading commit data...
cgroup Loading commit data...
firewire Loading commit data...
gpio Loading commit data...
hv Loading commit data...
iio Loading commit data...
include Loading commit data...
kvm/kvm_stat Loading commit data...
laptop Loading commit data...
leds Loading commit data...
lib Loading commit data...
net Loading commit data...
nfsd Loading commit data...
objtool Loading commit data...
pci Loading commit data...
pcmcia Loading commit data...
perf Loading commit data...
power Loading commit data...
scripts Loading commit data...
spi Loading commit data...
testing Loading commit data...
thermal/tmon Loading commit data...
time Loading commit data...
usb Loading commit data...
virtio Loading commit data...
vm Loading commit data...
Makefile Loading commit data...