All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shenwei Wang" <shenwei.wang@oss.nxp.com>
Cc: Frank.Li@kernel.org, devicetree@vger.kernel.org,
	conor+dt@kernel.org, imx@lists.linux.dev, robh@kernel.org
Subject: Re: [PATCH v15 3/5] rpmsg: core: match rpmsg device IDs by prefix
Date: Tue, 21 Jul 2026 21:01:18 +0000	[thread overview]
Message-ID: <20260721210119.2BBDA1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260721204704.400781-4-shenwei.wang@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Global change to prefix matching breaks exact match semantics, causing namespace collisions and incorrect driver binding.
- [High] Prefix matching breaks module auto-loading via udev because exported module aliases remain exact matches.
--

--- Patch [3]: [PATCH v15 3/5] rpmsg: core: match rpmsg device IDs by prefix ---
commit e561ac26959a610ff64bc4d231b963dec9f0caf9
Author: Shenwei Wang <shenwei.wang@nxp.com>

rpmsg: core: match rpmsg device IDs by prefix

This patch updates rpmsg_id_match to compare only the length of the driver's
ID string instead of the full RPMSG_NAME_SIZE. This allows id_table entries
to act as prefixes, enabling drivers to bind to dynamically suffixed device
names.

> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index 04bfcc75f05b4..97a4db52b0401 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -386,7 +386,9 @@ ATTRIBUTE_GROUPS(rpmsg_dev);
>  static inline int rpmsg_id_match(const struct rpmsg_device *rpdev,
>  				  const struct rpmsg_device_id *id)
>  {
> -	return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0;
> +	size_t len = strnlen(id->name, RPMSG_NAME_SIZE);
> +
> +	return strncmp(id->name, rpdev->id.name, len) == 0;

[Severity: High]
Does changing this to a strict prefix match prevent rpmsg drivers from
enforcing an exact name match?

If there is a driver for "sensor" and another for "sensor-temp", wouldn't
the "sensor" driver incorrectly bind to the "sensor-temp" device if it
happens to be evaluated first?

It appears the correct architectural way to multiplex multiple identical
services in the rpmsg framework is to use the exact same service name
(channel name) and distinguish instances using unique source and destination
endpoint addresses, rather than dynamically suffixed names.

[Severity: High]
Will this prefix matching logic break module auto-loading via udev?

When the firmware creates a device with a dynamically suffixed name,
rpmsg_uevent() emits a uevent containing the full suffixed name:

drivers/rpmsg/rpmsg_core.c:rpmsg_uevent() {
    ...
    return add_uevent_var(env, "MODALIAS=" RPMSG_DEVICE_MODALIAS_FMT,
                          rpdev->id.name);
}

However, scripts/mod/file2alias.c generates module aliases based on the
exact string in the rpmsg_device_id table, without a trailing wildcard:

scripts/mod/file2alias.c:do_rpmsg_entry() {
    ...
    module_alias_printf(mod, false, RPMSG_DEVICE_MODALIAS_FMT, *name);
    ...
}

Since the module alias lacks a wildcard, userspace tools like modprobe
will attempt an exact string match and fail to load the driver for the
suffixed device name.

>  }
>  
>  /* match rpmsg channel and rpmsg driver */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721204704.400781-1-shenwei.wang@oss.nxp.com?part=3

  reply	other threads:[~2026-07-21 21:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 20:46 [PATCH v15 0/5] Enable Remote GPIO over RPMSG on i.MX Platform Shenwei Wang
2026-07-21 20:46 ` [PATCH v15 1/5] docs: driver-api: gpio: rpmsg gpio driver over rpmsg bus Shenwei Wang
2026-07-21 20:46 ` [PATCH v15 2/5] dt-bindings: remoteproc: imx_rproc: Add "rpmsg" subnode support Shenwei Wang
2026-07-21 20:57   ` sashiko-bot
2026-07-21 20:46 ` [PATCH v15 3/5] rpmsg: core: match rpmsg device IDs by prefix Shenwei Wang
2026-07-21 21:01   ` sashiko-bot [this message]
2026-07-21 20:46 ` [PATCH v15 4/5] gpio: rpmsg: add generic rpmsg GPIO driver Shenwei Wang
2026-07-21 21:02   ` sashiko-bot
2026-07-23  6:33   ` Uwe Kleine-König
2026-07-21 20:46 ` [PATCH v15 5/5] arm64: dts: imx8ulp: Add rpmsg node under imx_rproc Shenwei Wang

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=20260721210119.2BBDA1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shenwei.wang@oss.nxp.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.