Thread (4 messages) 4 messages, 2 authors, 2019-10-24

Re: [PATCH bpf-next 1/2] xsk: store struct xdp_sock as a flexible array member of the XSKMAP

From: Jakub Kicinski <hidden>
Date: 2019-10-24 20:12:31
Also in: bpf

On Thu, 24 Oct 2019 09:19:30 +0200, Maciej Fijalkowski wrote:
quoted hunk ↗ jump to hunk
@@ -92,44 +94,36 @@ static struct bpf_map *xsk_map_alloc(union bpf_attr *attr)
 	    attr->map_flags & ~(BPF_F_NUMA_NODE | BPF_F_RDONLY | BPF_F_WRONLY))
 		return ERR_PTR(-EINVAL);
 
-	m = kzalloc(sizeof(*m), GFP_USER);
-	if (!m)
-		return ERR_PTR(-ENOMEM);
+	max_entries = attr->max_entries;
 
-	bpf_map_init_from_attr(&m->map, attr);
-	spin_lock_init(&m->lock);
+	size = sizeof(*m) + max_entries * sizeof(m->xsk_map[0]);
Maybe the array_size() I suggested to Toke was disputable, but this is
such an struct_size()...

Otherwise you probably need an explicit (u64) cast?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help