Merge git://git.kernel.org:/pub/scm/linux/kernel/git/netdev/net
[sfrench/cifs-2.6.git] / tools / lib / bpf / xsk.c
index ffbb588724d8fc79bae9fd7ff8182b9eb649808f..526fc35c0b23318621ec9e70169192a776bcb499 100644 (file)
@@ -610,15 +610,16 @@ static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
                if (fd < 0)
                        continue;
 
+               memset(&map_info, 0, map_len);
                err = bpf_obj_get_info_by_fd(fd, &map_info, &map_len);
                if (err) {
                        close(fd);
                        continue;
                }
 
-               if (!strcmp(map_info.name, "xsks_map")) {
+               if (!strncmp(map_info.name, "xsks_map", sizeof(map_info.name))) {
                        ctx->xsks_map_fd = fd;
-                       continue;
+                       break;
                }
 
                close(fd);