linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] bpf: fix warning about using plain integer as NULL
@ 2019-03-08  6:09 Bo YU
  2019-03-08  6:29 ` Y Song
  0 siblings, 1 reply; 2+ messages in thread
From: Bo YU @ 2019-03-08  6:09 UTC (permalink / raw)
  To: ast, daniel, kafai, ongliubraving, yhs, davem
  Cc: Bo YU, netdev, bpf, linux-kernel, yuzibode

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>
---
V2: Add fix-up tag from Yonghong
---
 include/linux/bpf-cgroup.h | 2 +-
 net/bpf/test_run.c         | 2 +-
 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,
 static inline void bpf_cgroup_storage_release(struct bpf_prog *prog,
 					      struct bpf_map *map) {}
 static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(
-	struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return 0; }
+	struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; }
 static inline void bpf_cgroup_storage_free(
 	struct bpf_cgroup_storage *storage) {}
 static 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 @@
 static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 			u32 *retval, u32 *time)
 {
-	struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { 0 };
+	struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL };
 	enum bpf_cgroup_storage_type stype;
 	u64 time_start, time_spent = 0;
 	int ret = 0;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] bpf: fix warning about using plain integer as NULL
  2019-03-08  6:09 [PATCH V2] bpf: fix warning about using plain integer as NULL Bo YU
@ 2019-03-08  6:29 ` Y Song
  0 siblings, 0 replies; 2+ messages in thread
From: Y Song @ 2019-03-08  6:29 UTC (permalink / raw)
  To: Bo YU
  Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau,
	ongliubraving, Yonghong Song, David Miller, netdev, bpf, LKML,
	yuzibode

On Thu, Mar 7, 2019 at 10:12 PM Bo YU <tsu.yubo@gmail.com> wrote:
>
> 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>

There should be no empty line between tags ("Fixes" and "Acked-by").
"Fixes" tag should be all in one line. My previous reply may be
wrapped by the email client, which is not my intention.

> ---
> V2: Add fix-up tag from Yonghong
> ---
>  include/linux/bpf-cgroup.h | 2 +-
>  net/bpf/test_run.c         | 2 +-
>  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,
>  static inline void bpf_cgroup_storage_release(struct bpf_prog *prog,
>                                               struct bpf_map *map) {}
>  static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(
> -       struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return 0; }
> +       struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; }
>  static inline void bpf_cgroup_storage_free(
>         struct bpf_cgroup_storage *storage) {}
>  static 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 @@
>  static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
>                         u32 *retval, u32 *time)
>  {
> -       struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { 0 };
> +       struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL };
>         enum bpf_cgroup_storage_type stype;
>         u64 time_start, time_spent = 0;
>         int ret = 0;
> --
> 2.11.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-08  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-08  6:09 [PATCH V2] bpf: fix warning about using plain integer as NULL Bo YU
2019-03-08  6:29 ` Y Song

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).