buf_prevkey in generic_map_lookup_batch() is allocated with kmalloc(). It's safe to free it with kfree().
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -1399,7 +1399,7 @@ int generic_map_lookup_batch(struct bpf_map *map, · 1398 unmodified lines | |||
| 1399 | 1399 | ||
| 1400 | buf = kmalloc(map->key_size + value_size, GFP_USER | __GFP_NOWARN); | 1400 | buf = kmalloc(map->key_size + value_size, GFP_USER | __GFP_NOWARN); |
| 1401 | if (!buf) { | 1401 | if (!buf) { |
| 1402 | kvfree(buf_prevkey); | 1402 | kfree(buf_prevkey); |
| 1403 | return -ENOMEM; | 1403 | return -ENOMEM; |
| 1404 | } | 1404 | } |
| 1405 | 1405 | ||