* [PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform
@ 2017-09-29 17:52 Martin KaFai Lau
2017-09-30 19:05 ` Daniel Borkmann
2017-10-01 3:11 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Martin KaFai Lau @ 2017-09-29 17:52 UTC (permalink / raw)
To: netdev; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team
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>
---
kernel/bpf/syscall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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++)
--
2.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform
2017-09-29 17:52 [PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform Martin KaFai Lau
@ 2017-09-30 19:05 ` Daniel Borkmann
2017-10-01 3:11 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2017-09-30 19:05 UTC (permalink / raw)
To: Martin KaFai Lau, netdev; +Cc: Alexei Starovoitov, kernel-team
On 09/29/2017 07:52 PM, Martin KaFai Lau wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform
2017-09-29 17:52 [PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform Martin KaFai Lau
2017-09-30 19:05 ` Daniel Borkmann
@ 2017-10-01 3:11 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-10-01 3:11 UTC (permalink / raw)
To: kafai; +Cc: netdev, ast, daniel, kernel-team
From: Martin KaFai Lau <kafai@fb.com>
Date: Fri, 29 Sep 2017 10:52:17 -0700
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-01 3:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-29 17:52 [PATCH net-next] bpf: Fix compiler warning on info.map_ids for 32bit platform Martin KaFai Lau
2017-09-30 19:05 ` Daniel Borkmann
2017-10-01 3:11 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).