Skip to content

Commit

Permalink
bpf: Change kvfree to kfree in generic_map_lookup_batch()
Browse files Browse the repository at this point in the history
buf_prevkey in generic_map_lookup_batch() is allocated with
kmalloc(). It's safe to free it with kfree().

Fixes: cb4d03a ("bpf: Add generic support for lookup batch op")
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200601162814.17426-1-efremov@linux.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Denis Efremov authored and Alexei Starovoitov committed Jun 1, 2020
1 parent 7b80581 commit bb2359f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/bpf/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ int generic_map_lookup_batch(struct bpf_map *map,

buf = kmalloc(map->key_size + value_size, GFP_USER | __GFP_NOWARN);
if (!buf) {
kvfree(buf_prevkey);
kfree(buf_prevkey);
return -ENOMEM;
}

Expand Down

0 comments on commit bb2359f

Please sign in to comment.