Skip to content

Commit 08e52cc

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: prefer nft_trans_elem_alloc helper
Reduce references to sizeof(struct nft_trans_elem). Preparation patch to move this to a flexiable array to store elem references. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 544dded commit 08e52cc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6409,7 +6409,7 @@ static void nf_tables_setelem_notify(const struct nft_ctx *ctx,
64096409
nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
64106410
}
64116411

6412-
static struct nft_trans *nft_trans_elem_alloc(struct nft_ctx *ctx,
6412+
static struct nft_trans *nft_trans_elem_alloc(const struct nft_ctx *ctx,
64136413
int msg_type,
64146414
struct nft_set *set)
64156415
{
@@ -7471,13 +7471,11 @@ static int __nft_set_catchall_flush(const struct nft_ctx *ctx,
74717471
{
74727472
struct nft_trans *trans;
74737473

7474-
trans = nft_trans_alloc_gfp(ctx, NFT_MSG_DELSETELEM,
7475-
sizeof(struct nft_trans_elem), GFP_KERNEL);
7474+
trans = nft_trans_elem_alloc(ctx, NFT_MSG_DELSETELEM, set);
74767475
if (!trans)
74777476
return -ENOMEM;
74787477

74797478
nft_setelem_data_deactivate(ctx->net, set, elem_priv);
7480-
nft_trans_elem_set(trans) = set;
74817479
nft_trans_elem_priv(trans) = elem_priv;
74827480
nft_trans_commit_list_add_tail(ctx->net, trans);
74837481

0 commit comments

Comments
 (0)