summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBo YU <tsu.yubo@gmail.com>2019-03-08 01:45:51 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2019-03-08 15:17:07 -0500
commit71b91a506bb05f9aef3acd57af2e835d85721942 (patch)
treedb5e36b4a6f88551cc9a3b9e80a8bcce720679df
parentc57b557b644da624982c36b74f608cdb7b902868 (diff)
bpf: fix warning about using plain integer as NULL
Sparse warning below: sudo make C=2 CF=-D__CHECK_ENDIAN__ M=net/bpf/ CHECK net/bpf//test_run.c net/bpf//test_run.c:19:77: warning: Using plain integer as NULL pointer ./include/linux/bpf-cgroup.h:295:77: warning: Using plain integer as NULL pointer Fixes: 8bad74f9840f ("bpf: extend cgroup bpf core to allow multiple cgroup storage types") Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Bo YU <tsu.yubo@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--include/linux/bpf-cgroup.h2
-rw-r--r--net/bpf/test_run.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 695b2a880d9a..a4c644c1c091 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -292,7 +292,7 @@ static inline int bpf_cgroup_storage_assign(struct bpf_prog *prog,
292static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, 292static inline void bpf_cgroup_storage_release(struct bpf_prog *prog,
293 struct bpf_map *map) {} 293 struct bpf_map *map) {}
294static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( 294static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(
295 struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return 0; } 295 struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; }
296static inline void bpf_cgroup_storage_free( 296static inline void bpf_cgroup_storage_free(
297 struct bpf_cgroup_storage *storage) {} 297 struct bpf_cgroup_storage *storage) {}
298static inline int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, 298static inline int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key,
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index da7051d62727..fab142b796ef 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -16,7 +16,7 @@
16static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, 16static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
17 u32 *retval, u32 *time) 17 u32 *retval, u32 *time)
18{ 18{
19 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { 0 }; 19 struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL };
20 enum bpf_cgroup_storage_type stype; 20 enum bpf_cgroup_storage_type stype;
21 u64 time_start, time_spent = 0; 21 u64 time_start, time_spent = 0;
22 int ret = 0; 22 int ret = 0;