1. 09 Feb, 2017 2 commits
    • Arnaldo Carvalho de Melo's avatar
      perf bench numa: Avoid possible truncation when using snprintf() · 3aff8ba0
      Arnaldo Carvalho de Melo authored
      Addressing this warning from gcc 7:
      
          CC       /tmp/build/perf/bench/numa.o
        bench/numa.c: In function '__bench_numa':
        bench/numa.c:1582:42: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 8 and 17 [-Werror=format-truncation=]
             snprintf(tname, 32, "process%d:thread%d", p, t);
                                                  ^~
        bench/numa.c:1582:25: note: directive argument in the range [0, 2147483647]
             snprintf(tname, 32, "process%d:thread%d", p, t);
                                 ^~~~~~~~~~~~~~~~~~~~
        In file included from /usr/include/stdio.h:939:0,
                         from bench/../util/util.h:47,
                         from bench/../builtin.h:4,
                         from bench/numa.c:11:
        /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 17 and 35 bytes into a destination of size 32
           return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                __bos (__s), __fmt, __va_arg_pack ());
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Petr Holasek <pholasek@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-twa37vsfqcie5gwpqwnjuuz9@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3aff8ba0
    • Arnaldo Carvalho de Melo's avatar
      perf header: Fix handling of PERF_EVENT_UPDATE__SCALE · 8434a2ec
      Arnaldo Carvalho de Melo authored
      In commit daeecbc0 ("perf tools: Add event_update event scale type"), the
      handling of PERF_EVENT_UPDATE__SCALE cast struct event_update_event->data to a
      pointer to event_update_event_scale, uses some field from this casted struct
      and then ends up falling through to the handling of another event type,
      PERF_EVENT_UPDATE__CPUS were it casts that ev->data to yet another type, oops,
      fix it by inserting the missing break.
      
      Noticed when building perf using gcc 7 on Fedora Rawhide:
      
        util/header.c: In function 'perf_event__process_event_update':
        util/header.c:3207:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
           evsel->scale = ev_scale->scale;
           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
        util/header.c:3208:2: note: here
          case PERF_EVENT_UPDATE__CPUS:
          ^~~~
      
      This wasn't noticed because probably PERF_EVENT_UPDATE__CPUS comes after
      PERF_EVENT_UPDATE__SCALE, so we would just create a bogus evsel->own_cpus when
      processing a PERF_EVENT_UPDATE__SCALE to then leak it and create a new cpu map
      with the correct data.
      
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Fixes: daeecbc0 ("perf tools: Add event_update event scale type")
      Link: http://lkml.kernel.org/n/tip-lukcf9hdj092ax2914ss95at@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8434a2ec
  2. 08 Feb, 2017 28 commits
  3. 06 Feb, 2017 1 commit
  4. 03 Feb, 2017 1 commit
  5. 02 Feb, 2017 8 commits