From: netdev-bot+sashiko@kernel.org
To: adrianox@gmail.com
Cc: alex.aring@gmail.com, stefan@datenfreihafen.org,
miquel.raynal@bootlin.com, linux-wpan@vger.kernel.org,
netdev@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH 2/2] ieee802154: warn on unspecific wpan interface type
Date: Tue, 08 Sep 2026 18:20:38 +0000 [thread overview]
Message-ID: <178889163868.219967.6937684996365515536@kernel.org> (raw)
In-Reply-To: <20260905212007.304875-2-adrianox@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 1 · Low: 0
- [Medium] The added WARN_ON fails to detect uninitialized iftypes
because wpan_dev->iftype zero-initializes to NL802154_IFTYPE_NODE (0),…
--
> diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
> --- a/net/ieee802154/core.c
> +++ b/net/ieee802154/core.c
> @@ -297,7 +297,7 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb,
>
> rdev = wpan_phy_to_rdev(wpan_dev->wpan_phy);
>
> - /* TODO WARN_ON unspec type */
> + WARN_ON(wpan_dev->iftype == NL802154_IFTYPE_UNSPEC);
>
> switch (state) {
> case NETDEV_POST_INIT:
[Severity: Medium]
This check cannot fire for the case the commit message says it is
meant to catch. In enum nl802154_iftype (include/uapi/linux/nl802154.h)
NL802154_IFTYPE_UNSPEC is ~(__u32)0 while NL802154_IFTYPE_NODE is 0, so
a wpan_dev whose iftype was never assigned - the struct lives in the
zeroed netdev private area handed out by alloc_netdev(), and
ieee802154_setup_sdata() is the only place that writes it - reads back
as NL802154_IFTYPE_NODE, not UNSPEC. The WARN_ON in
cfg802154_netdev_notifier_call() therefore only triggers if some caller
explicitly stores UNSPEC (or -1, given wpan_dev->iftype is a plain int
and the comparison promotes it to unsigned), which no in-tree code does.
As written this is dead code rather than the assertion described.
Note this is unlike cfg80211, where NL80211_IFTYPE_UNSPECIFIED is 0 and
the same test does catch a zeroed field, so the pattern does not carry
over directly.
How do you want to handle this? Either the sanity check needs to be
expressed in terms of a value that an uninitialized wpan_dev actually
holds, or ieee802154_setup_sdata() and the other wpan_dev producers
need to start out at NL802154_IFTYPE_UNSPEC so the warning has
something to detect. Please also say whether you actually observed the
condition, or whether this is intended purely as a future-proofing
assertion.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260905212007.304875-1-adrianox%40gmail.com
next prev parent reply other threads:[~2026-09-08 18:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 21:20 [PATCH 1/2] ieee802154: register a device type for the wpan netdev Adriano Cordova
2026-09-05 21:20 ` [PATCH 2/2] ieee802154: warn on unspecific wpan interface type Adriano Cordova
2026-09-07 6:29 ` Miquel Raynal
2026-09-08 18:20 ` netdev-bot+sashiko [this message]
2026-09-07 6:29 ` [PATCH 1/2] ieee802154: register a device type for the wpan netdev Miquel Raynal
2026-09-08 18:20 ` netdev-bot+sashiko
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=178889163868.219967.6937684996365515536@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=adrianox@gmail.com \
--cc=alex.aring@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=stefan@datenfreihafen.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