Commit 2874aa2e authored by Martin KaFai Lau's avatar Martin KaFai Lau Committed by David S. Miller

bpf: Fix compilation warning in __bpf_lru_list_rotate_inactive

gcc-6.2.1 gives the following warning:
kernel/bpf/bpf_lru_list.c: In function ‘__bpf_lru_list_rotate_inactive.isra.3’:
kernel/bpf/bpf_lru_list.c:201:28: warning: ‘next’ may be used uninitialized in this function [-Wmaybe-uninitialized]

The "next" is currently initialized in the while() loop which must have >=1
iterations.

This patch initializes next to get rid of the compiler warning.

Fixes: 3a08c2fd ("bpf: LRU List")
Reported-by: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46738b13
...@@ -170,7 +170,7 @@ static void __bpf_lru_list_rotate_inactive(struct bpf_lru *lru, ...@@ -170,7 +170,7 @@ static void __bpf_lru_list_rotate_inactive(struct bpf_lru *lru,
struct bpf_lru_list *l) struct bpf_lru_list *l)
{ {
struct list_head *inactive = &l->lists[BPF_LRU_LIST_T_INACTIVE]; struct list_head *inactive = &l->lists[BPF_LRU_LIST_T_INACTIVE];
struct list_head *cur, *next, *last; struct list_head *cur, *last, *next = inactive;
struct bpf_lru_node *node; struct bpf_lru_node *node;
unsigned int i = 0; unsigned int i = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment