All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Carlos Falgueras García" <carlosfg@riseup.net>
Cc: netfilter-devel@vger.kernel.org, kaber@trash.net
Subject: Re: [PATCH 1/4] nf: netfilter: nf_tables_api: Add new attributes into nft_set to store user data.
Date: Tue, 5 Jan 2016 11:34:06 +0100	[thread overview]
Message-ID: <20160105103406.GA2828@salvia> (raw)
In-Reply-To: <1451849900-18077-1-git-send-email-carlosfg@riseup.net>

On Sun, Jan 03, 2016 at 08:38:17PM +0100, Carlos Falgueras García wrote:
> @@ -2816,12 +2823,16 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
>  	if (IS_ERR(ops))
>  		return PTR_ERR(ops);
>  
> +	udlen = 0;
> +	if (nla[NFTA_SET_USERDATA])
> +		udlen = nla_len(nla[NFTA_SET_USERDATA]);
> +
>  	size = 0;
>  	if (ops->privsize != NULL)
>  		size = ops->privsize(nla);
>  
>  	err = -ENOMEM;
> -	set = kzalloc(sizeof(*set) + size, GFP_KERNEL);
> +	set = kzalloc(sizeof(*set) + size + udlen, GFP_KERNEL);
>  	if (set == NULL)
>  		goto err1;
>  
> @@ -2830,6 +2841,12 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
>  	if (err < 0)
>  		goto err2;
>  
> +	udata = NULL;
> +	if (nla[NFTA_SET_USERDATA]) {

I think this should be:

        if (udlen)

instead, to ignore zero length user data.

> +		udata = set->data + size;
> +		nla_memcpy(udata, nla[NFTA_SET_USERDATA], udlen);
> +	}
> +
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2016-01-05 10:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03 19:38 [PATCH 1/4] nf: netfilter: nf_tables_api: Add new attributes into nft_set to store user data Carlos Falgueras García
2016-01-03 19:38 ` [PATCH 2/4] libnftnl: set: Add new attribute into 'set' to store an arbitrary length " Carlos Falgueras García
2016-01-03 19:38 ` [PATCH 3/4] libnftnl: set: Implement new buffer of TLV objects Carlos Falgueras García
2016-01-04 12:06   ` Patrick McHardy
2016-01-03 19:38 ` [PATCH 4/4] libnftnl: examples: Modify the example to allow add TLV objects as user data Carlos Falgueras García
2016-01-04 12:32 ` [PATCH 1/4] nf: netfilter: nf_tables_api: Add new attributes into nft_set to store " Patrick McHardy
2016-01-05 10:34 ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160105103406.GA2828@salvia \
    --to=pablo@netfilter.org \
    --cc=carlosfg@riseup.net \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.