Skip to content

Commit

Permalink
Fix type of default key when creating BPF maps
Browse files Browse the repository at this point in the history
The default key (0) used to populate various BPF maps was declared as
uint32_t. but the 'dvars' BPF map uses a uint64_t key.  Since we know
that the value of the key will always be 0, it is safe to just make it
uint64_t for all maps, and have it be interpreted as uint32_t for the
maps that use a smaller key size.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
  • Loading branch information
kvanhees committed Dec 9, 2021
1 parent d2a29b0 commit 8046dc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libdtrace/dt_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ dt_bpf_gmap_create(dtrace_hdl_t *dtp)
int stabsz, gvarsz, lvarsz, aggsz, memsz;
int dvarc = 0;
int ci_mapfd, st_mapfd, pr_mapfd;
uint32_t key = 0;
uint64_t key = 0;
size_t strsize = dtp->dt_options[DTRACEOPT_STRSIZE];
uint8_t *buf, *end;
char *strtab;
Expand Down

0 comments on commit 8046dc7

Please sign in to comment.