linux-stable/tools/perf/arch/x86
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
..
annotate perf annotate: Handle variables in 'sub', 'or' and many other instructions 2018-04-13 10:00:05 -03:00
entry/syscalls perf tools: Update x86's syscall_64.tbl, adding 'io_pgetevents' and 'rseq' 2018-06-25 11:59:36 -03:00
include Merge branch 'linus' into perf/core, to fix conflicts 2017-11-07 10:30:18 +01:00
tests perf map: Remove map_type arg from map_groups__find() 2018-04-26 13:47:18 -03:00
util perf tools: Fix compilation errors on gcc8 2018-07-11 09:39:57 -04:00
Build perf tests: Add arch tests 2015-10-05 16:55:38 -03:00
Makefile tools/headers: Synchronize kernel ABI headers, v4.17-rc1 2018-04-17 09:47:39 -03:00