1. 10 2月, 2017 2 次提交
    • A
      perf tests: Avoid possible truncation with dirent->d_name + snprintf · 2e2bbc03
      Arnaldo Carvalho de Melo 提交于
      Addressing a few cases spotted by a new warning in gcc 7:
      
        tests/parse-events.c: In function 'test_pmu_events':
        tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=]
           snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
                                             ^~
        In file included from /usr/include/stdio.h:939:0,
                         from /git/linux/tools/perf/util/map.h:9,
                         from /git/linux/tools/perf/util/symbol.h:7,
                         from /git/linux/tools/perf/util/evsel.h:10,
                         from tests/parse-events.c:3:
        /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100
           return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                __bos (__s), __fmt, __va_arg_pack ());
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=]
           snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
      
      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: Wang Nan <wangnan0@huawei.com>
      Fixes: 945aea22 ("perf tests: Move test objects into 'tests' directory")
      Link: http://lkml.kernel.org/n/tip-ty4q2p8zp1dp3mskvubxskm5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2e2bbc03
    • A
      perf bench numa: Avoid possible truncation when using snprintf() · 3aff8ba0
      Arnaldo Carvalho de Melo 提交于
      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: NArnaldo Carvalho de Melo <acme@redhat.com>
      3aff8ba0
  2. 09 2月, 2017 14 次提交
  3. 08 2月, 2017 15 次提交
  4. 02 2月, 2017 3 次提交
  5. 01 2月, 2017 6 次提交