summaryrefslogtreecommitdiffstats
path: root/kernel/bpf/syscall.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2017-09-29 19:52:17 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-01 05:09:42 +0200
commit721e08dad17e226ef68819d0a23dc53c25fe8ea5 (patch)
treec4cbe3a70e040358c9a0310f4b9a035750652952 /kernel/bpf/syscall.c
parentnet_sched: remove redundant assignment to ret (diff)
downloadlinux-721e08dad17e226ef68819d0a23dc53c25fe8ea5.tar.xz
linux-721e08dad17e226ef68819d0a23dc53c25fe8ea5.zip
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 <kafai@fb.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--kernel/bpf/syscall.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 11a7f82a55d1..b927da66f653 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -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++)