bpf: Fix cast to pointer from integer of different size warning

Fix "warning: cast to pointer from integer of different size" when
casting u64 addr to void *.

Fixes: a23740ec43 ("bpf: Track contents of read-only maps as scalars")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191011172053.2980619-1-andriin@fb.com
This commit is contained in:
Andrii Nakryiko 2019-10-11 10:20:53 -07:00 committed by Daniel Borkmann
parent f97eea1756
commit 2dedd7d216
1 changed files with 1 additions and 1 deletions

View File

@ -2753,7 +2753,7 @@ static int bpf_map_direct_read(struct bpf_map *map, int off, int size, u64 *val)
err = map->ops->map_direct_value_addr(map, &addr, off);
if (err)
return err;
ptr = (void *)addr + off;
ptr = (void *)(long)addr + off;
switch (size) {
case sizeof(u8):