• Matteo Croce's avatar
    samples, bpf: suppress compiler warning · 3c24a931
    Matteo Croce authored
    [ Upstream commit a195cefff49f60054998333e81ee95170ce8bf92 ]
    
    GCC 9 fails to calculate the size of local constant strings and produces a
    false positive:
    
    samples/bpf/task_fd_query_user.c: In function ‘test_debug_fs_uprobe’:
    samples/bpf/task_fd_query_user.c:242:67: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 215 [-Wformat-truncation=]
      242 |  snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/%ss/%s/id",
          |                                                                   ^~
      243 |    event_type, event_alias);
          |                ~~~~~~~~~~~
    samples/bpf/task_fd_query_user.c:242:2: note: ‘snprintf’ output between 45 and 300 bytes into a destination of size 256
      242 |  snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/%ss/%s/id",
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      243 |    event_type, event_alias);
          |    ~~~~~~~~~~~~~~~~~~~~~~~~
    
    Workaround this by lowering the buffer size to a reasonable value.
    Related GCC Bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83431Signed-off-by: default avatarMatteo Croce <mcroce@redhat.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    3c24a931
Name
Last commit
Last update
..
auxdisplay Loading commit data...
bpf Loading commit data...
configfs Loading commit data...
connector Loading commit data...
hidraw Loading commit data...
hw_breakpoint Loading commit data...
kdb Loading commit data...
kfifo Loading commit data...
kobject Loading commit data...
kprobes Loading commit data...
livepatch Loading commit data...
mei Loading commit data...
mic/mpssd Loading commit data...
pktgen Loading commit data...
qmi Loading commit data...
rpmsg Loading commit data...
seccomp Loading commit data...
statx Loading commit data...
timers Loading commit data...
trace_events Loading commit data...
trace_printk Loading commit data...
uhid Loading commit data...
v4l Loading commit data...
vfio-mdev Loading commit data...
watchdog Loading commit data...
Kconfig Loading commit data...
Makefile Loading commit data...