[OpenWrt-Devel] [PATCH] [ubox] kmodloader: increase module name length

Bjørn Mork bjorn at mork.no
Mon Feb 18 09:24:03 EST 2019


Sergiy Kibrik <sakib at darkstar.site> writes:

> Otherwise modules with long names, e.g. lttng (>32 chars) can't be loaded.
>
> Signed-off-by: Sergiy Kibrik <sakib at 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);

Agreed that 33 is not enough, but NAME_MAX is way overkill again.  Why
not use the actual max length from the kernel?:

 include/linux/module.h:#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
 include/linux/moduleparam.h:#define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))


Bjørn

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list