]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
selftests/bpf: fix constness of source arg for bpf helpers
authorAndrii Nakryiko <andriin@fb.com>
Mon, 10 Jun 2019 17:46:55 +0000 (10:46 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 11 Jun 2019 06:39:50 +0000 (23:39 -0700)
Fix signature of bpf_probe_read and bpf_probe_write_user to mark source
pointer as const. This causes warnings during compilation for
applications relying on those helpers.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/bpf_helpers.h

index e6d243b7cd74c49ed53ea69156847f105a4c22b2..1a5b1accf091c0e65bcf31e70ae59daef22d5cda 100644 (file)
@@ -31,7 +31,7 @@ static int (*bpf_map_pop_elem)(void *map, void *value) =
        (void *) BPF_FUNC_map_pop_elem;
 static int (*bpf_map_peek_elem)(void *map, void *value) =
        (void *) BPF_FUNC_map_peek_elem;
-static int (*bpf_probe_read)(void *dst, int size, void *unsafe_ptr) =
+static int (*bpf_probe_read)(void *dst, int size, const void *unsafe_ptr) =
        (void *) BPF_FUNC_probe_read;
 static unsigned long long (*bpf_ktime_get_ns)(void) =
        (void *) BPF_FUNC_ktime_get_ns;
@@ -62,7 +62,7 @@ static int (*bpf_perf_event_output)(void *ctx, void *map,
        (void *) BPF_FUNC_perf_event_output;
 static int (*bpf_get_stackid)(void *ctx, void *map, int flags) =
        (void *) BPF_FUNC_get_stackid;
-static int (*bpf_probe_write_user)(void *dst, void *src, int size) =
+static int (*bpf_probe_write_user)(void *dst, const void *src, int size) =
        (void *) BPF_FUNC_probe_write_user;
 static int (*bpf_current_task_under_cgroup)(void *map, int index) =
        (void *) BPF_FUNC_current_task_under_cgroup;