[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200313235309.34matqh7iaahawkf@kafai-mbp>
Date: Fri, 13 Mar 2020 16:53:09 -0700
From: Martin KaFai Lau <kafai@...com>
To: Andrii Nakryiko <andriin@...com>
CC: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>, <ast@...com>,
<daniel@...earbox.net>, <andrii.nakryiko@...il.com>,
<kernel-team@...com>
Subject: Re: [Potential Spoof] [PATCH bpf-next] selftest/bpf: fix compilation
warning in sockmap_parse_prog.c
On Fri, Mar 13, 2020 at 04:07:15PM -0700, Andrii Nakryiko wrote:
> Cast void * to long before casting to 32-bit __u32 to avoid compilation
> warning.
>
> Signed-off-by: Andrii Nakryiko <andriin@...com>
> ---
> tools/testing/selftests/bpf/progs/sockmap_parse_prog.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c b/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
> index a5c6d5903b22..a9c2bdbd841e 100644
> --- a/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
> +++ b/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
> @@ -12,7 +12,7 @@ int bpf_prog1(struct __sk_buff *skb)
> __u32 lport = skb->local_port;
> __u32 rport = skb->remote_port;
> __u8 *d = data;
> - __u32 len = (__u32) data_end - (__u32) data;
I think this line can be removed. "len" is not used.
> + __u32 len = (__u32)(long)data_end - (__u32)(long)data;
> int err;
>
> if (data + 10 > data_end) {
> --
> 2.17.1
>
Powered by blists - more mailing lists