On Mon, 18 Feb 2019 at 21:15, Sergiy Kibrik <sa...@darkstar.site> wrote: > > Otherwise modules with long names, e.g. lttng (>32 chars) can't be loaded. > > Signed-off-by: Sergiy Kibrik <sa...@darkstar.site> > --- > kmodloader.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kmodloader.c b/kmodloader.c > index 3196deb..67e3706 100644 > --- a/kmodloader.c > +++ b/kmodloader.c > @@ -157,7 +157,7 @@ static char* get_module_path(char *name) > > static char* get_module_name(char *path) > { > - static char name[33]; > + static char name[NAME_MAX]; > char *t; > > strncpy(name, basename(path), sizeof(name) - 1);
Note that NAME_MAX does not count the trailing null char. It's 255 on CentOS 7. Personally I think it's okay to use NAME_MAX here. The macro is well-documented and size of file names also apply to names of kmod files. yousong > -- > 2.7.4 > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel