[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YWSD8O0lw6kaGmRD@lore-desk>
Date: Mon, 11 Oct 2021 20:35:28 +0200
From: Lorenzo Bianconi <lorenzo@...nel.org>
To: Jakub Kicinski <kuba@...nel.org>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
lorenzo.bianconi@...hat.com, davem@...emloft.net, ast@...nel.org,
daniel@...earbox.net, shayagr@...zon.com, john.fastabend@...il.com,
dsahern@...nel.org, brouer@...hat.com, echaudro@...hat.com,
jasowang@...hat.com, alexander.duyck@...il.com, saeed@...nel.org,
maciej.fijalkowski@...el.com, magnus.karlsson@...el.com,
tirthendu.sarkar@...el.com, toke@...hat.com
Subject: Re: [PATCH v15 bpf-next 17/18] net: xdp: introduce bpf_xdp_pointer
utility routine
> On Fri, 8 Oct 2021 14:49:55 +0200 Lorenzo Bianconi wrote:
> > +BPF_CALL_4(bpf_xdp_load_bytes, struct xdp_buff *, xdp, u32, offset,
> > + void *, buf, u32, len)
> > +{
> > + void *ptr;
> > +
> > + if (!buf)
> > + return -EINVAL;
>
> Can we make the verifier ensure it's not NULL?
I guess we can use ARG_PTR_TO_MEM instead of ARG_PTR_TO_UNINIT_MEM
>
> > + ptr = bpf_xdp_pointer(xdp, offset, len, buf);
> > + if (ptr != buf)
> > + memcpy(buf, ptr, len);
>
> Don't we need to return an error in case offset + length > frame size?
ack, I will fix it.
Regards,
Lorenzo
>
> > + return 0;
> > +}
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists