* [PATCH bpf-next] bpf: fix cast to pointer from integer of different size warning
@ 2019-10-11 4:29 Andrii Nakryiko
2019-10-11 5:15 ` [Potential Spoof] " Martin Lau
0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2019-10-11 4:29 UTC (permalink / raw)
To: bpf, netdev, ast, daniel; +Cc: andriin
Fix "warning: cast to pointer from integer of different size" when
casting u64 addr to void *.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index b818fed3208d..d3446f018b9a 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -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):
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Potential Spoof] [PATCH bpf-next] bpf: fix cast to pointer from integer of different size warning
2019-10-11 4:29 [PATCH bpf-next] bpf: fix cast to pointer from integer of different size warning Andrii Nakryiko
@ 2019-10-11 5:15 ` Martin Lau
2019-10-11 17:18 ` Andrii Nakryiko
0 siblings, 1 reply; 3+ messages in thread
From: Martin Lau @ 2019-10-11 5:15 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: bpf, netdev, Alexei Starovoitov, daniel
On Thu, Oct 10, 2019 at 09:29:25PM -0700, Andrii Nakryiko wrote:
> Fix "warning: cast to pointer from integer of different size" when
> casting u64 addr to void *.
>
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Fixes: a23740ec43ba ("bpf: Track contents of read-only maps as scalars")
Acked-by: Martin KaFai Lau <kafai@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Potential Spoof] [PATCH bpf-next] bpf: fix cast to pointer from integer of different size warning
2019-10-11 5:15 ` [Potential Spoof] " Martin Lau
@ 2019-10-11 17:18 ` Andrii Nakryiko
0 siblings, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2019-10-11 17:18 UTC (permalink / raw)
To: Martin Lau; +Cc: Andrii Nakryiko, bpf, netdev, Alexei Starovoitov, daniel
On Thu, Oct 10, 2019 at 10:16 PM Martin Lau <kafai@fb.com> wrote:
>
> On Thu, Oct 10, 2019 at 09:29:25PM -0700, Andrii Nakryiko wrote:
> > Fix "warning: cast to pointer from integer of different size" when
> > casting u64 addr to void *.
> >
> > Reported-by: kbuild test robot <lkp@intel.com>
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> Fixes: a23740ec43ba ("bpf: Track contents of read-only maps as scalars")
Oh, right, thanks! I'll post v2 w/ Ack and Fixes tags.
>
> Acked-by: Martin KaFai Lau <kafai@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-11 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 4:29 [PATCH bpf-next] bpf: fix cast to pointer from integer of different size warning Andrii Nakryiko
2019-10-11 5:15 ` [Potential Spoof] " Martin Lau
2019-10-11 17:18 ` Andrii Nakryiko
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).