On Fri, Sep 9, 2022 at 4:32 PM Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > On Fri, Sep 9, 2022 at 8:29 AM Song Liu <song@xxxxxxxxxx> wrote: > > > > On Thu, Sep 8, 2022 at 1:10 AM Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > > [...] > > > > Let's return NULL for void* type. > > > > > > > > - if (bpf_dynptr_is_rdonly(ptr)) > > > + if (writable && bpf_dynptr_is_rdonly(ptr)) > > > return 0; > > ditto > > > > > > type = bpf_dynptr_get_type(ptr); > > > @@ -1610,13 +1610,31 @@ BPF_CALL_3(bpf_dynptr_data, struct bpf_dynptr_kern *, ptr, u32, offset, u32, len > > > /* if the requested data in across fragments, then it cannot > > > * be accessed directly - bpf_xdp_pointer will return NULL > > > */ > > > - return (unsigned long)bpf_xdp_pointer(ptr->data, > > > - ptr->offset + offset, len); > > > + return bpf_xdp_pointer(ptr->data, ptr->offset + offset, len); > > > default: > > > - WARN_ONCE(true, "bpf_dynptr_data: unknown dynptr type %d\n", type); > > > + WARN_ONCE(true, "__bpf_dynptr_data: unknown dynptr type %d\n", type); > > > > Let's use __func__ so we don't have to change this again. > > > > WARN_ONCE(true, "%s: unknown dynptr type %d\n", __func__, type); > > WARN includes file and line automatically. > Do we really need func here too? I think func is helpful when I read a slightly different version of the code and line number changes. (Well, maybe I shouldn't do this.) I won't mind if we remove it. We just shouldn't hard code it manually. Thanks, Song