On Wed, Mar 20, 2019 at 01:27:42PM +0100, Michal Rostecki wrote:
> BPF maps do not have to be named, so map names can be NULL. Map name
> pointers should be checked before doing any operations which cannot be
> done on NULL pointers.
>
> This issue was detected by the following errors coming from bpftool
> built with AddressSanitizer:
>
> bpf.c:256:2: runtime error: null pointer passed as argument 2, which is
> declared to never be null
> bpf.c:92:2: runtime error: null pointer passed as argument 2, which is
> declared to never be null
> bpf.c:169:2: runtime error: null pointer passed as argument 2, which is
> declared to never be null
>
> Fixes: 88cda1c9da02 ("bpf: libbpf: Provide basic API support to specify BPF
> obj name")
> Fixes: d7be143b67c2 ("libbpf: Support expected_attach_type at prog load")
> Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
> Signed-off-by: Michal Rostecki <[email protected]>
I don't think that's necessary. memcpy is fine with src==null and len==0