This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fdf5095c6ef0079f3c98957f1f5da39e4a4a5af2 Author: wangshaoxin <[email protected]> AuthorDate: Thu Aug 6 10:47:55 2026 +0800 drivers/misc/rpmsgdev: keep a copy of the remote cpu and path rpmsgdev_register() kept the caller's remotecpu and remotepath pointers and used them later from the rpmsg callbacks. Copy the strings into the device. Signed-off-by: wangshaoxin <[email protected]> Signed-off-by: Bowen Wang <[email protected]> --- drivers/misc/rpmsgdev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/misc/rpmsgdev.c b/drivers/misc/rpmsgdev.c index 3d5a760e380..47e7bd4c394 100644 --- a/drivers/misc/rpmsgdev.c +++ b/drivers/misc/rpmsgdev.c @@ -83,8 +83,13 @@ struct rpmsgdev_priv_s struct rpmsgdev_s { struct rpmsg_endpoint ept; /* Rpmsg endpoint */ - FAR const char *remotecpu; /* The server cpu name */ - FAR const char *remotepath; /* The device path in the server cpu */ + + /* The server cpu name and the device path in the server cpu */ + + char remotecpu[RPMSG_NAME_SIZE]; + char remotepath[RPMSG_NAME_SIZE - + RPMSGDEV_NAME_PREFIX_LEN]; + sem_t wait; /* Wait sem, used for preventing any * operation until the connection * between two cpu established. @@ -1317,7 +1322,7 @@ int rpmsgdev_register(FAR const char *remotecpu, FAR const char *remotepath, return -EINVAL; } - DEBUGASSERT(strlen(remotepath) + RPMSGDEV_NAME_PREFIX_LEN <= + DEBUGASSERT(strlen(remotepath) + RPMSGDEV_NAME_PREFIX_LEN < RPMSG_NAME_SIZE); dev = kmm_zalloc(sizeof(*dev)); @@ -1328,8 +1333,8 @@ int rpmsgdev_register(FAR const char *remotecpu, FAR const char *remotepath, /* Initialize the rpmsg device */ - dev->remotecpu = remotecpu; - dev->remotepath = remotepath; + strlcpy(dev->remotecpu, remotecpu, sizeof(dev->remotecpu)); + strlcpy(dev->remotepath, remotepath, sizeof(dev->remotepath)); nxsem_init(&dev->wait, 0, 0); spin_lock_init(&dev->lock);
