summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-07-16 05:57:03 +0200
committerAlexei Starovoitov <ast@kernel.org>2019-07-16 19:34:31 +0200
commit763ff0e7d9c72e7094b31e7fb84a859be9325635 (patch)
tree2191a3de1b7c6de93a7fb506eba6c2d4f44c093d /tools/lib
parentselftests/bpf: skip nmi test when perf hw events are disabled (diff)
downloadlinux-763ff0e7d9c72e7094b31e7fb84a859be9325635.tar.xz
linux-763ff0e7d9c72e7094b31e7fb84a859be9325635.zip
libbpf: fix another GCC8 warning for strncpy
Similar issue was fixed in cdfc7f888c2a ("libbpf: fix GCC8 warning for strncpy") already. This one was missed. Fixing now. Cc: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/xsk.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index b33740221b7e..5007b5d4fd2c 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -517,7 +517,8 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
err = -errno;
goto out_socket;
}
- strncpy(xsk->ifname, ifname, IFNAMSIZ);
+ strncpy(xsk->ifname, ifname, IFNAMSIZ - 1);
+ xsk->ifname[IFNAMSIZ - 1] = '\0';
err = xsk_set_xdp_socket_config(&xsk->config, usr_config);
if (err)