From: David Ahern <dsahern@gmail.com>
To: Andrea Claudi <aclaudi@redhat.com>, netdev@vger.kernel.org
Cc: stephen@networkplumber.org, dsahern@kernel.org
Subject: Re: [PATCH iproute2-next v2] bpf: replace snprintf with asprintf when dealing with long buffers
Date: Thu, 19 Sep 2019 08:48:50 -0600 [thread overview]
Message-ID: <bea3013b-376e-64a5-6ec8-ab54957018d9@gmail.com> (raw)
In-Reply-To: <c25efdff9a67ed4bc23862d0ef4ff8073de69c4e.1568638725.git.aclaudi@redhat.com>
On 9/16/19 7:00 AM, Andrea Claudi wrote:
> This reduces stack usage, as asprintf allocates memory on the heap.
>
> This indirectly fixes a snprintf truncation warning (from gcc v9.2.1):
>
> bpf.c: In function ‘bpf_get_work_dir’:
> bpf.c:784:49: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
> 784 | snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt);
> | ^
> bpf.c:784:2: note: ‘snprintf’ output between 2 and 4097 bytes into a destination of size 4096
> 784 | snprintf(bpf_wrk_dir, sizeof(bpf_wrk_dir), "%s/", mnt);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fixes: e42256699cac ("bpf: make tc's bpf loader generic and move into lib")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
> lib/bpf.c | 155 ++++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 116 insertions(+), 39 deletions(-)
>
applied to iproute2-next. Thanks
prev parent reply other threads:[~2019-09-19 14:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 13:00 [PATCH iproute2-next v2] bpf: replace snprintf with asprintf when dealing with long buffers Andrea Claudi
2019-09-19 14:48 ` David Ahern [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=bea3013b-376e-64a5-6ec8-ab54957018d9@gmail.com \
--to=dsahern@gmail.com \
--cc=aclaudi@redhat.com \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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