Skip to content

Commit 6f67093

Browse files
Phil Sutterummakynes
authored andcommitted
netfilter: nf_tables: Sort labels in nft_netdev_hook_alloc()
No point in having err_hook_alloc, just call return directly. Also rename err_hook_dev - it's not about the hook's device but freeing the hook itself. Signed-off-by: Phil Sutter <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 7b48564 commit 6f67093

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,15 +2315,14 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,
23152315
int err;
23162316

23172317
hook = kzalloc(sizeof(struct nft_hook), GFP_KERNEL_ACCOUNT);
2318-
if (!hook) {
2319-
err = -ENOMEM;
2320-
goto err_hook_alloc;
2321-
}
2318+
if (!hook)
2319+
return ERR_PTR(-ENOMEM);
2320+
23222321
INIT_LIST_HEAD(&hook->ops_list);
23232322

23242323
err = nla_strscpy(hook->ifname, attr, IFNAMSIZ);
23252324
if (err < 0)
2326-
goto err_hook_dev;
2325+
goto err_hook_free;
23272326

23282327
hook->ifnamelen = nla_len(attr);
23292328

@@ -2334,22 +2333,21 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,
23342333
dev = __dev_get_by_name(net, hook->ifname);
23352334
if (!dev) {
23362335
err = -ENOENT;
2337-
goto err_hook_dev;
2336+
goto err_hook_free;
23382337
}
23392338

23402339
ops = kzalloc(sizeof(struct nf_hook_ops), GFP_KERNEL_ACCOUNT);
23412340
if (!ops) {
23422341
err = -ENOMEM;
2343-
goto err_hook_dev;
2342+
goto err_hook_free;
23442343
}
23452344
ops->dev = dev;
23462345
list_add_tail(&ops->list, &hook->ops_list);
23472346

23482347
return hook;
23492348

2350-
err_hook_dev:
2349+
err_hook_free:
23512350
kfree(hook);
2352-
err_hook_alloc:
23532351
return ERR_PTR(err);
23542352
}
23552353

0 commit comments

Comments
 (0)