Re: [PATCH nf-next 02/11] netfilter: nf_tables: move bind list_head into relevant subtypes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Florian,

I like this series, just a comestic glitch.

On Mon, May 13, 2024 at 03:00:42PM +0200, Florian Westphal wrote:
> @@ -416,11 +436,26 @@ static int nft_deltable(struct nft_ctx *ctx)
>  	return err;
>  }
>  
> -static struct nft_trans *nft_trans_chain_add(struct nft_ctx *ctx, int msg_type)
> +static struct nft_trans *
> +nft_trans_alloc_chain(const struct nft_ctx *ctx, int msg_type)
>  {
>  	struct nft_trans *trans;
>  
>  	trans = nft_trans_alloc(ctx, msg_type, sizeof(struct nft_trans_chain));
> +	if (trans) {

May I mangle this to do here:

        if (!trans)
                return NULL;

...

> +		struct nft_trans_chain *chain = nft_trans_container_chain(trans);
> +
> +		INIT_LIST_HEAD(&chain->nft_trans_binding.binding_list);
> +	}
> +
> +	return trans;
> +}
> +
> +static struct nft_trans *nft_trans_chain_add(struct nft_ctx *ctx, int msg_type)
> +{
> +	struct nft_trans *trans;
> +
> +	trans = nft_trans_alloc_chain(ctx, msg_type);
>  	if (trans == NULL)
>  		return ERR_PTR(-ENOMEM);
>  
> @@ -560,12 +595,16 @@ static int __nft_trans_set_add(const struct nft_ctx *ctx, int msg_type,
>  			       struct nft_set *set,
>  			       const struct nft_set_desc *desc)
>  {
> +	struct nft_trans_set *trans_set;
>  	struct nft_trans *trans;
>  
>  	trans = nft_trans_alloc(ctx, msg_type, sizeof(struct nft_trans_set));
>  	if (trans == NULL)
>  		return -ENOMEM;

As it is done here?

>  
> +	trans_set = nft_trans_container_set(trans);
> +	INIT_LIST_HEAD(&trans_set->nft_trans_binding.binding_list);
> +
>  	if (msg_type == NFT_MSG_NEWSET && ctx->nla[NFTA_SET_ID] && !desc) {
>  		nft_trans_set_id(trans) =
>  			ntohl(nla_get_be32(ctx->nla[NFTA_SET_ID]));




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux