On Mon, Jul 31, 2023 at 01:47:01PM -0700, Alexei Starovoitov wrote: > Probably the following will be enough: > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > index 56ce5008aedd..eb91cae0612a 100644 > --- a/kernel/bpf/helpers.c > +++ b/kernel/bpf/helpers.c > @@ -2270,7 +2270,7 @@ __bpf_kfunc void *bpf_dynptr_slice(const struct > bpf_dynptr_kern *ptr, u32 offset > case BPF_DYNPTR_TYPE_XDP: > { > void *xdp_ptr = bpf_xdp_pointer(ptr->data, ptr->offset > + offset, len); > - if (xdp_ptr) > + if (!IS_ERR_OR_NULL(xdp_ptr)) > return xdp_ptr; Also please, add a comment to bpf_xdp_pointer() which explains what the NULL return means. I couldn't figure it out. > > Also I've noticed: > void bpf_xdp_copy_buf(struct xdp_buff *xdp, unsigned long off, > void *buf, unsigned long len, bool flush); > #else /* CONFIG_NET */ > static inline void *bpf_xdp_pointer(struct xdp_buff *xdp, u32 offset, u32 len) > { > return NULL; > } > > The latter is wrong. This the only part which I thought I understood. :P How is this wrong? regards, dan carpenter