All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>
Subject: Re: [libnftnl PATCH v2] Introduce struct nftnl_str_array
Date: Mon, 28 Oct 2024 23:59:23 +0100	[thread overview]
Message-ID: <ZyAXS49_WEHaXBRa@calendula> (raw)
In-Reply-To: <20241023202119.27681-1-phil@nwl.cc>

On Wed, Oct 23, 2024 at 10:21:04PM +0200, Phil Sutter wrote:
[...]
> @@ -325,12 +295,11 @@ void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh,
>  
>  	if (c->flags & (1 << NFTNL_FLOWTABLE_DEVICES)) {
>  		struct nlattr *nest_dev;
> +		const char *dev;
>  
>  		nest_dev = mnl_attr_nest_start(nlh, NFTA_FLOWTABLE_HOOK_DEVS);
> -		for (i = 0; i < c->dev_array_len; i++) {
> -			mnl_attr_put_strz(nlh, NFTA_DEVICE_NAME,
> -					  c->dev_array[i]);
> -		}
> +		nftnl_str_array_foreach(dev, &c->dev_array, i)

Where is this nftnl_str_array_foreach defined? I don't find it in this
patch.

[...]
> +void nftnl_str_array_clear(struct nftnl_str_array *sa)
> +{
> +	while (sa->len > 0)
> +		free(sa->array[--sa->len]);
> +	free(sa->array);
> +	sa->array = NULL;

This is new, I'm fine with this, but it is only defensive, right?
This stale reference would not be reached because attribute flag is
cleared.

> +}
[...]
> diff --git a/src/utils.c b/src/utils.c
> index 2f1ffd6227583..157b15f7afe8d 100644
> --- a/src/utils.c
> +++ b/src/utils.c
> @@ -19,6 +19,7 @@
>  
>  #include <libnftnl/common.h>
>  
> +#include <libmnl/libmnl.h>
>  #include <linux/netfilter.h>
>  #include <linux/netfilter/nf_tables.h>

Remove this chunk? It looks unrelated.

  reply	other threads:[~2024-10-28 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 20:21 [libnftnl PATCH v2] Introduce struct nftnl_str_array Phil Sutter
2024-10-28 22:59 ` Pablo Neira Ayuso [this message]
2024-10-29 12:15   ` Phil Sutter

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=ZyAXS49_WEHaXBRa@calendula \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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.