lkml.org 
[lkml]   [2016]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH 9/9] samples/bpf: test percpu array map
Date
From: Ming Lei
> Sent: 11 January 2016 15:57
...
> ---
> samples/bpf/test_maps.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 110 insertions(+)
>
> diff --git a/samples/bpf/test_maps.c b/samples/bpf/test_maps.c
> index 6299ee9..ff5d373 100644
> --- a/samples/bpf/test_maps.c
> +++ b/samples/bpf/test_maps.c
> @@ -142,6 +142,106 @@ static void test_arraymap_sanity(int i, void *data)
> close(map_fd);
> }
>
> +static int handle_one_cpu(unsigned cpu, void *val_cpu, void *val)
> +{
> + unsigned long *cnt = val;
> +
> + *cnt += *(long *)val_cpu;

Integer pointer casts ring big alarm bells - they are accidents
waiting to happen.

If the pointers are 'pointer to long' then define them as such.

David

\
 
 \ /
  Last update: 2016-01-12 17:21    [W:1.212 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site