bpf: Fix compiler warning on info.map_ids for 32bit platform
Subsystems (4)
PATCH 1/1 bpf: Fix compiler warning on info.map_ids for 32bit platform
This patch uses u64_to_user_ptr() to cast info.map_ids to a userspace ptr. It also tags the user_map_ids with '__user' for sparse check.
Fixes cb4d2b3f03d8 ("bpf: Add name, load_time, uid and map_ids to bpf_prog_info")
Signed-off-by Martin KaFai Lau <[email protected]>
--- kernel/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/syscall.c +1 -1
@@ -1405,7 +1405,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, info.nr_map_ids = prog->aux->used_map_cnt; ulen =min_t (u32, info.nr_map_ids, ulen);if (ulen) { -u32 *user_map_ids = (u32 *)info.map_ids; +u32 __user *user_map_ids =u64_to_user_ptr (info.map_ids);u32 i;for (i =0 ; i < ulen; i++)
Signature · 1 line
2.9.5
Quoted 5 lines · Martin KaFai Lau
This patch uses
u64_to_user_ptr()to cast info.map_ids to a userspace ptr. It also tags theuser_map_idswith '__user' for sparse check.Fixes cb4d2b3f03d8 ("bpf: Add name, load_time, uid and map_ids to bpf_prog_info")Signed-off-by Martin KaFai Lau <[email protected]>
Acked-by Daniel Borkmann <[email protected]>
From: Martin KaFai Lau <[email protected]>
Date: Fri, 29 Sep 2017 10:52:17 -0700
Quoted 5 lines
This patch uses
u64_to_user_ptr()to cast info.map_ids to a userspace ptr. It also tags theuser_map_idswith '__user' for sparse check.Fixes cb4d2b3f03d8 ("bpf: Add name, load_time, uid and map_ids to bpf_prog_info")Signed-off-by Martin KaFai Lau <[email protected]>
Applied.