[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc8634e8-6efd-9911-cab4-07ad6ba4ad33@iogearbox.net>
Date: Tue, 1 Nov 2022 14:56:23 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Rong Tao <rtoax@...mail.com>, david.laight@...lab.com
Cc: andrii.nakryiko@...il.com, andrii@...nel.org, ast@...nel.org,
bpf@...r.kernel.org, haoluo@...gle.com, john.fastabend@...il.com,
jolsa@...nel.org, kpsingh@...nel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, martin.lau@...ux.dev,
mykolal@...com, rongtao@...tc.cn, sdf@...gle.com, shuah@...nel.org,
song@...nel.org, yhs@...com
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix strncpy() fortify warning
On 11/1/22 1:21 PM, Rong Tao wrote:
> From: Rong Tao <rongtao@...tc.cn>
>
> move libbpf_strlcpy() to bpf_util.h, and replace strncpy() with
> libbpf_strlcpy(), fix compile warning.
>
> Compile samples/bpf, warning:
> $ cd samples/bpf
> $ make
> ...
> cgroup_helpers.c: In function ‘__enable_controllers’:
> cgroup_helpers.c:80:17: warning: ‘strncpy’ specified bound 4097 equals destination size [-Wstringop-truncation]
> 80 | strncpy(enable, controllers, sizeof(enable));
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
BPF CI now throws a new warning after your patch:
https://github.com/kernel-patches/bpf/actions/runs/3369416153/jobs/5589052613
[...]
xsk.c:536:2: error: call to undeclared function 'libbpf_strlcpy'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
libbpf_strlcpy(ifr.ifr_name, ctx->ifname, IFNAMSIZ);
^
xsk.c:755:2: error: call to undeclared function 'libbpf_strlcpy'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
libbpf_strlcpy(ctx->ifname, ifname, IFNAMSIZ);
^
xsk.c:942:2: error: call to undeclared function 'libbpf_strlcpy'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
libbpf_strlcpy(ctx->ifname, ifname, IFNAMSIZ);
^
3 errors generated.
make: *** [Makefile:166: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/xsk.o] Error 1
make: *** Waiting for unfinished jobs....
Powered by blists - more mailing lists