Skip to content

Commit

Permalink
Allow NULL as map name in dt_bpf_map_create()
Browse files Browse the repository at this point in the history
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
  • Loading branch information
kvanhees committed Aug 31, 2022
1 parent 1c4f17d commit aeca759
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libdtrace/dt_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ dt_bpf_map_create(enum bpf_map_type map_type, const char *name,
attr.value_size = value_size;
attr.max_entries = max_entries;
attr.map_flags = map_flags;
memcpy(attr.map_name, name, MIN(strlen(name),
sizeof(attr.map_name) - 1));
if (name)
memcpy(attr.map_name, name, MIN(strlen(name),
sizeof(attr.map_name) - 1));

return bpf(BPF_MAP_CREATE, &attr);
}
Expand Down

0 comments on commit aeca759

Please sign in to comment.