Netfilter-Devel Archive mirror
 help / color / mirror / Atom feed
From: Quan Tian <tianquan23@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org,
	kadlec@netfilter.org
Subject: Re: [PATCH v2 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store userdata for nft_table
Date: Mon, 11 Mar 2024 22:21:52 +0800	[thread overview]
Message-ID: <Ze8TgMaRLfFKsYaj@ubuntu-1-2> (raw)
In-Reply-To: <20240310230923.GA20853@breakpoint.cc>

On Mon, Mar 11, 2024 at 12:09:23AM +0100, Florian Westphal wrote:
> Quan Tian <tianquan23@gmail.com> wrote:
> > To prepare for the support for table comment updates, the patch changes
> > to store userdata in struct nlattr *, which can be updated atomically on
> > updates.
> > 
> > Signed-off-by: Quan Tian <tianquan23@gmail.com>
> > ---
> > v2: Change to store userdata in struct nlattr * to ensure atomical update
> 
> Looks good, one minor nit below.
> 
> >  	if (nla[NFTA_TABLE_USERDATA]) {
> > -		table->udata = nla_memdup(nla[NFTA_TABLE_USERDATA], GFP_KERNEL_ACCOUNT);
> > +		table->udata = kmemdup(nla[NFTA_TABLE_USERDATA],
> > +				       nla_total_size(nla_len(nla[NFTA_TABLE_USERDATA])),
> > +				       GFP_KERNEL_ACCOUNT);
> 
> I think its correct but it might make sense to add a small helper for
> this kmemdup so we don't need to copypaste in case this should get
> extended to e.g. chain udata update support.

Extracted a function as suggested in v3, and also used it when
duplicating the userdata when preparing trans for table updates.
After this is merged, I could extend comment update support for other
objects in the same fashion.

Thanks,
Quan

      reply	other threads:[~2024-03-11 14:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 17:28 [PATCH v2 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store userdata for nft_table Quan Tian
2024-03-10 17:28 ` [PATCH v2 nf-next 2/2] netfilter: nf_tables: support updating " Quan Tian
2024-03-10 17:47   ` Florian Westphal
2024-03-11 14:12     ` Quan Tian
2024-03-10 23:09 ` [PATCH v2 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store " Florian Westphal
2024-03-11 14:21   ` Quan Tian [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=Ze8TgMaRLfFKsYaj@ubuntu-1-2 \
    --to=tianquan23@gmail.com \
    --cc=fw@strlen.de \
    --cc=kadlec@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).