Skip to content

Commit

Permalink
libbpf: fix max() type mismatch for 32bit
Browse files Browse the repository at this point in the history
It fixes build error for 32bit caused by type mismatch
size_t/unsigned long.

Fixes: bf82927 ("libbpf: refactor map initialization")
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Ivan Khoronzhuk authored and Daniel Borkmann committed Jun 26, 2019
1 parent 9cda780 commit 9506497
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/lib/bpf/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ static struct bpf_map *bpf_object__add_map(struct bpf_object *obj)
if (obj->nr_maps < obj->maps_cap)
return &obj->maps[obj->nr_maps++];

new_cap = max(4ul, obj->maps_cap * 3 / 2);
new_cap = max((size_t)4, obj->maps_cap * 3 / 2);
new_maps = realloc(obj->maps, new_cap * sizeof(*obj->maps));
if (!new_maps) {
pr_warning("alloc maps for object failed\n");
Expand Down

0 comments on commit 9506497

Please sign in to comment.