From f45eaa608d44ec72eef5db58f9695de662a75d13 Mon Sep 17 00:00:00 2001 From: yintao Date: Fri, 8 Mar 2024 17:29:39 +0800 Subject: [PATCH] rpmsgdev: devpath may exceed RPMSG_NAME_SIZE Signed-off-by: yintao --- drivers/misc/rpmsgdev.c | 3 +++ drivers/misc/rpmsgdev.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/misc/rpmsgdev.c b/drivers/misc/rpmsgdev.c index 3f801b1ccb..7e13875d31 100644 --- a/drivers/misc/rpmsgdev.c +++ b/drivers/misc/rpmsgdev.c @@ -1160,6 +1160,9 @@ int rpmsgdev_register(FAR const char *remotecpu, FAR const char *remotepath, return -EINVAL; } + DEBUGASSERT(strlen(remotepath) + RPMSGDEV_NAME_PREFIX_LEN <= + RPMSG_NAME_SIZE); + dev = kmm_zalloc(sizeof(*dev)); if (dev == NULL) { diff --git a/drivers/misc/rpmsgdev.h b/drivers/misc/rpmsgdev.h index f0254f1534..5d777950aa 100644 --- a/drivers/misc/rpmsgdev.h +++ b/drivers/misc/rpmsgdev.h @@ -33,8 +33,8 @@ * Pre-processor definitions ****************************************************************************/ -#define RPMSGDEV_NAME_PREFIX "rpmsgdev-" -#define RPMSGDEV_NAME_PREFIX_LEN 9 +#define RPMSGDEV_NAME_PREFIX "rpdev-" +#define RPMSGDEV_NAME_PREFIX_LEN 6 #define RPMSGDEV_OPEN 1 #define RPMSGDEV_CLOSE 2