[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bea3013b-376e-64a5-6ec8-ab54957018d9@gmail.com>
Date: Thu, 19 Sep 2019 08:48:50 -0600
From: David Ahern <dsahern@...il.com>
To: Andrea Claudi <aclaudi@...hat.com>, netdev@...r.kernel.org
Cc: stephen@...workplumber.org, dsahern@...nel.org
Subject: Re: [PATCH iproute2-next v2] bpf: replace snprintf with asprintf when
dealing with long buffers
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@...hat.com>
> ---
> lib/bpf.c | 155 ++++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 116 insertions(+), 39 deletions(-)
>
applied to iproute2-next. Thanks
Powered by blists - more mailing lists