From: Jakub Kicinski <kuba@kernel.org>
To: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Donald Hunter <donald.hunter@gmail.com>,
Simon Horman <horms@kernel.org>,
Jacob Keller <jacob.e.keller@intel.com>,
Stanislav Fomichev <sdf@fomichev.me>,
"Matthieu Baerts (NGI0)" <matttbe@kernel.org>,
David Ahern <dsahern@kernel.org>,
Chuck Lever <chuck.lever@oracle.com>,
wireguard@lists.zx2c4.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 3/4] tools: ynl-gen: fix nested array counting
Date: Mon, 1 Sep 2025 11:56:50 -0700 [thread overview]
Message-ID: <20250901115650.107e078e@kernel.org> (raw)
In-Reply-To: <20250901145034.525518-4-ast@fiberby.net>
On Mon, 1 Sep 2025 14:50:22 +0000 Asbjørn Sloth Tønnesen wrote:
> The blamed commit introduced the concept of split attribute
> counting, and later allocating an array to hold them, however
> TypeArrayNest wasn't updated to use the new counting variable.
>
> Abbreviated example from tools/net/ynl/generated/nl80211-user.c:
> nl80211_if_combination_attributes_parse(...):
> unsigned int n_limits = 0;
> [...]
> ynl_attr_for_each(attr, nlh, yarg->ys->family->hdr_len)
> if (type == NL80211_IFACE_COMB_LIMITS)
> ynl_attr_for_each_nested(attr2, attr)
> dst->_count.limits++;
> if (n_limits) {
> dst->_count.limits = n_limits;
> /* allocate and parse attributes */
> }
>
> In the above example n_limits is guaranteed to always be 0,
> hence the conditional is unsatisfiable and is optimized out.
>
> This patch changes the attribute counting to use n_limits++ in the
> attribute counting loop in the above example.
Looks good, thanks!
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
next prev parent reply other threads:[~2025-09-01 18:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 14:50 [PATCH net 0/4] tools: ynl-gen: misc fixes + wireguard ynl plan Asbjørn Sloth Tønnesen
2025-09-01 14:50 ` [PATCH net 1/4] netlink: specs: fou: change local-v6/peer-v6 check Asbjørn Sloth Tønnesen
2025-09-01 18:50 ` Jakub Kicinski
2025-09-01 14:50 ` [PATCH net 2/4] tools: ynl-gen: use macro for binary min-len check Asbjørn Sloth Tønnesen
2025-09-01 18:52 ` Jakub Kicinski
2025-09-01 21:10 ` Asbjørn Sloth Tønnesen
2025-09-01 14:50 ` [PATCH net 3/4] tools: ynl-gen: fix nested array counting Asbjørn Sloth Tønnesen
2025-09-01 18:56 ` Jakub Kicinski [this message]
2025-09-01 14:50 ` [PATCH net 4/4] genetlink: fix typo in comment Asbjørn Sloth Tønnesen
2025-09-01 18:57 ` Jakub Kicinski
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=20250901115650.107e078e@kernel.org \
--to=kuba@kernel.org \
--cc=ast@fiberby.net \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matttbe@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=wireguard@lists.zx2c4.com \
/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.