mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 05:44:45 +01:00
bpf: Remove unnecessary kfree(im_node) in lpm_trie_update_elem
There is no need to call kfree(im_node) when updating element fails, because im_node must be NULL. Remove the unnecessary kfree() for im_node. Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/r/20241206110622.1161752-3-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
156c977c53
commit
3d5611b4d7
1 changed files with 1 additions and 3 deletions
|
|
@ -315,7 +315,7 @@ static long trie_update_elem(struct bpf_map *map,
|
|||
void *_key, void *value, u64 flags)
|
||||
{
|
||||
struct lpm_trie *trie = container_of(map, struct lpm_trie, map);
|
||||
struct lpm_trie_node *node, *im_node = NULL, *new_node = NULL;
|
||||
struct lpm_trie_node *node, *im_node, *new_node = NULL;
|
||||
struct lpm_trie_node *free_node = NULL;
|
||||
struct lpm_trie_node __rcu **slot;
|
||||
struct bpf_lpm_trie_key_u8 *key = _key;
|
||||
|
|
@ -431,9 +431,7 @@ out:
|
|||
if (ret) {
|
||||
if (new_node)
|
||||
trie->n_entries--;
|
||||
|
||||
kfree(new_node);
|
||||
kfree(im_node);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&trie->lock, irq_flags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue