linux-stable/tools/perf/arch
Jiri Olsa a09603f851 perf tools: Fix compilation errors on gcc8
We are getting following warnings on gcc8 that break compilation:

  $ make
    CC       jvmti/jvmti_agent.o
  jvmti/jvmti_agent.c: In function ‘jvmti_open’:
  jvmti/jvmti_agent.c:252:35: error: ‘/jit-’ directive output may be truncated \
    writing 5 bytes into a region of size between 1 and 4096 [-Werror=format-truncation=]
    snprintf(dump_path, PATH_MAX, "%s/jit-%i.dump", jit_path, getpid());

There's no point in checking the result of snprintf call in
jvmti_open, the following open call will fail in case the
name is mangled or too long.

Using tools/lib/ function scnprintf that touches the return value from
the snprintf() calls and thus get rid of those warnings.

  $ make DEBUG=1
    CC       arch/x86/util/perf_regs.o
  arch/x86/util/perf_regs.c: In function ‘arch_sdt_arg_parse_op’:
  arch/x86/util/perf_regs.c:229:4: error: ‘strncpy’ output truncated before terminating nul
  copying 2 bytes from a string of the same length [-Werror=stringop-truncation]
    strncpy(prefix, "+0", 2);
    ^~~~~~~~~~~~~~~~~~~~~~~~

Using scnprintf instead of the strncpy (which we know is safe in here)
to get rid of that warning.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180702134202.17745-1-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-07-11 09:39:57 -04:00
..
alpha perf tools: Add empty Build files for architectures lacking them 2015-08-06 16:24:15 -03:00
arm perf map: Remove map_type arg from map_groups__find() 2018-04-26 13:47:18 -03:00
arm64 perf map: Remove map_type arg from map_groups__find() 2018-04-26 13:47:18 -03:00
mips perf tools: Add empty Build files for architectures lacking them 2015-08-06 16:24:15 -03:00
parisc perf tools: Add empty Build files for architectures lacking them 2015-08-06 16:24:15 -03:00
powerpc perf report powerpc: Fix crash if callchain is empty 2018-06-25 11:59:35 -03:00
s390 perf record: Fix s390 undefined record__auxtrace_init() return value 2018-04-23 12:05:02 -03:00
sh License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sparc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
x86 perf tools: Fix compilation errors on gcc8 2018-07-11 09:39:57 -04:00
xtensa License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Build perf tools: Fix build with ARCH=x86_64 2017-06-14 15:44:29 -03:00
common.c perf annotate: Move objdump_path to struct annotation_options 2018-06-04 10:28:53 -03:00
common.h perf annotate: Move objdump_path to struct annotation_options 2018-06-04 10:28:53 -03:00