From: sashiko-bot@kernel.org
To: "Rasmus Villemoes" <linux@rasmusvillemoes.dk>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH] watchdog: take all OF aliases into account when assigning id
Date: Mon, 15 Jun 2026 15:08:22 +0000 [thread overview]
Message-ID: <20260615150823.511211F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260615145759.3142743-1-linux@rasmusvillemoes.dk>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Watchdog devices without a device tree alias will completely fail to register if any watchdog alias in the system has an ID >= MAX_DOGS - 1 (31).
--
commit 8dd153efc0fe9ba312373b449e8eef726a399693
Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
watchdog: take all OF aliases into account when assigning id
This commit ensures that watchdog devices without a device tree alias are
allocated an ID greater than the highest numbered alias in the system. This
prevents devices without aliases from consuming IDs that are intended for
devices with aliases depending on probe order.
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 8300520688d07..d1f3fa741a4f7 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
[ ... ]
> @@ -265,8 +265,15 @@ static int ___watchdog_register_device(struct watchdog_device *wdd)
> GFP_KERNEL);
> }
>
> - if (id < 0)
> - id = ida_alloc_max(&watchdog_ida, MAX_DOGS - 1, GFP_KERNEL);
> + if (id < 0) {
> + ret = of_alias_get_highest_id("watchdog");
> + if (ret >= 0)
> + min_id = ret + 1;
> + else
> + min_id = 0;
> +
> + id = ida_alloc_range(&watchdog_ida, min_id, MAX_DOGS - 1, GFP_KERNEL);
[Severity: High]
Does this code prevent unaliased watchdogs from registering if the system
defines a high watchdog alias?
If a system defines a watchdog alias with an ID of MAX_DOGS - 1 or greater,
min_id will evaluate to MAX_DOGS or greater. When passed to
ida_alloc_range() with a max limit of MAX_DOGS - 1, the requested minimum
will exceed the maximum limit, causing ida_alloc_range() to return -ENOSPC.
This would fail the device registration unconditionally for any unaliased
watchdog.
> + }
>
> if (id < 0)
> return id;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260615145759.3142743-1-linux@rasmusvillemoes.dk?part=1
prev parent reply other threads:[~2026-06-15 15:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 14:57 [PATCH] watchdog: take all OF aliases into account when assigning id Rasmus Villemoes
2026-06-15 15:08 ` sashiko-bot [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=20260615150823.511211F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=sashiko-reviews@lists.linux.dev \
/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