bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Matteo Croce <mcroce@redhat.com>,
	xdp-newbies@vger.kernel.org, bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>
Subject: Re: [PATCH bpf] samples/bpf: suppress compiler warning
Date: Tue, 21 May 2019 16:56:34 +0200	[thread overview]
Message-ID: <f874efcb-f2a2-1d5f-7c43-cebdb828e465@iogearbox.net> (raw)
In-Reply-To: <20190520214938.16889-1-mcroce@redhat.com>

On 05/20/2019 11:49 PM, Matteo Croce wrote:
> 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=83431
> 
> Signed-off-by: Matteo Croce <mcroce@redhat.com>

Applied, thanks!

      reply	other threads:[~2019-05-21 14:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20 21:49 [PATCH bpf] samples/bpf: suppress compiler warning Matteo Croce
2019-05-21 14:56 ` Daniel Borkmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f874efcb-f2a2-1d5f-7c43-cebdb828e465@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcroce@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=xdp-newbies@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).