[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191024131222.70ca703b@cakuba.hsd1.ca.comcast.net>
Date: Thu, 24 Oct 2019 13:12:22 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
Toke Høiland-Jørgensen
<toke@...hat.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...com,
daniel@...earbox.net, magnus.karlsson@...el.com,
bjorn.topel@...el.com
Subject: Re: [PATCH bpf-next 1/2] xsk: store struct xdp_sock as a flexible
array member of the XSKMAP
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?
Powered by blists - more mailing lists