• Song Liu's avatar
    perf hists browser: Increase size of 'buf' in perf_evsel__hists_browse() · 86449b12
    Song Liu authored
    Making perf with gcc-9.1.1 generates the following warning:
    
        CC       ui/browsers/hists.o
      ui/browsers/hists.c: In function 'perf_evsel__hists_browse':
      ui/browsers/hists.c:3078:61: error: '%d' directive output may be \
      truncated writing between 1 and 11 bytes into a region of size \
      between 2 and 12 [-Werror=format-truncation=]
    
       3078 |       "Max event group index to sort is %d (index from 0 to %d)",
            |                                                             ^~
      ui/browsers/hists.c:3078:7: note: directive argument in the range [-2147483648, 8]
       3078 |       "Max event group index to sort is %d (index from 0 to %d)",
            |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /usr/include/stdio.h:937,
                       from ui/browsers/hists.c:5:
    
    IOW, the string in line 3078 might be too long for buf[] of 64 bytes.
    
    Fix this by increasing the size of buf[] to 128.
    
    Fixes: dbddf174  ("perf report/top TUI: Support hotkeys to let user select any event for sorting")
    Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Jin Yao <yao.jin@linux.intel.com>
    Cc: stable@vger.kernel.org # v5.7+
    Link: http://lore.kernel.org/lkml/20201030235431.534417-1-songliubraving@fb.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    86449b12
hists.c 93.2 KB