diff options
author | Mark Brown <broonie@kernel.org> | 2018-05-22 10:28:38 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-05-22 10:28:38 +0100 |
commit | e1c51aa8705fd78e5259e0515aad3b5003e18550 (patch) | |
tree | 3728628142a24460d6b488e5331f421f902e5d3a /kernel/bpf/hashtab.c | |
parent | 6e49b7fa3083c30688b7fff1b37ed891cd1c30af (diff) | |
parent | 08556e03ad36b2c6219aba90de88ccf58038e208 (diff) |
Merge branch 'linux-linaro-lsk-v4.9' into linux-linaro-lsk-v4.9-rtlinux-linaro-lsk-v4.9-rt-test
Diffstat (limited to 'kernel/bpf/hashtab.c')
-rw-r--r-- | kernel/bpf/hashtab.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index ad2f0ed75471..a36a532c056d 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -326,12 +326,15 @@ static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key) struct hlist_head *head; struct htab_elem *l, *next_l; u32 hash, key_size; - int i; + int i = 0; WARN_ON_ONCE(!rcu_read_lock_held()); key_size = map->key_size; + if (!key) + goto find_first_elem; + hash = htab_map_hash(key, key_size); head = select_bucket(htab, hash); @@ -339,10 +342,8 @@ static int htab_map_get_next_key(struct bpf_map *map, void *key, void *next_key) /* lookup the key */ l = lookup_elem_raw(head, hash, key, key_size); - if (!l) { - i = 0; + if (!l) goto find_first_elem; - } /* key was found, get next key in the same bucket */ next_l = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(&l->hash_node)), |