Skip to content

Commit 2874aa2

Browse files
iamkafaidavem330
authored andcommitted
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: 3a08c2f ("bpf: LRU List") Reported-by: David Miller <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 46738b1 commit 2874aa2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/bpf/bpf_lru_list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static void __bpf_lru_list_rotate_inactive(struct bpf_lru *lru,
170170
struct bpf_lru_list *l)
171171
{
172172
struct list_head *inactive = &l->lists[BPF_LRU_LIST_T_INACTIVE];
173-
struct list_head *cur, *next, *last;
173+
struct list_head *cur, *last, *next = inactive;
174174
struct bpf_lru_node *node;
175175
unsigned int i = 0;
176176

0 commit comments

Comments
 (0)