On Thu, 24 Oct 2019 09:19:30 +0200, Maciej Fijalkowski wrote: > @@ -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?