From 26ab4e9200032cd5dec751b93845e6c70a63a963 Mon Sep 17 00:00:00 2001 From: zhuyanlin Date: Thu, 31 Mar 2022 18:30:17 +0800 Subject: [PATCH] mod_insmod: fix coverity warning Signed-off-by: zhuyanlin --- sched/module/mod_insmod.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sched/module/mod_insmod.c b/sched/module/mod_insmod.c index 82c0a27c2e..e63f0132a2 100644 --- a/sched/module/mod_insmod.c +++ b/sched/module/mod_insmod.c @@ -198,9 +198,11 @@ FAR void *insmod(FAR const char *filename, FAR const char *modname) goto errout_with_loadinfo; } +#ifdef HAVE_MODLIB_NAMES /* Save the module name in the registry entry */ - strlcpy(modp->modname, modname, MODLIB_NAMEMAX); + strlcpy(modp->modname, modname, sizeof(modp->modname)); +#endif /* Load the program binary */