Re: [PATCH v2 5/6] module/dups: Use strcmp() to compare module names

Aaron Tomlin <[email protected]> Sat, 25 Jul 2026 12:30:52 -0400
Newsgroups org.kernel.vger.linux-modules,org.kernel.vger.linux-kernel
Message-ID <5e4qydb4z4sxrdcpxq2sknwdjaibixmkyn3jqa3s3kfx43rnlq@ahfxhvvgkuh7>
On Thu, Jul 23, 2026 at 10:25:55AM +0200, Petr Pavlu wrote:
> Use strcmp() instead of strlen()+memcmp() to compare module names in
> kmod_dup_request_lookup(), since all strings are NUL-terminated.
> 
> Signed-off-by: Petr Pavlu <[email protected]>
> ---
>  kernel/module/dups.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/module/dups.c b/kernel/module/dups.c
> index 56d659f049c5..80e1638ac34a 100644
> --- a/kernel/module/dups.c
> +++ b/kernel/module/dups.c
> @@ -72,11 +72,9 @@ static struct kmod_dup_req *kmod_dup_request_lookup(char *module_name)
>  	lockdep_assert_held(&kmod_dup_mutex);
>  
>  	list_for_each_entry(kmod_req, &dup_kmod_reqs, list) {
> -		if (strlen(kmod_req->name) == strlen(module_name) &&
> -		    !memcmp(kmod_req->name, module_name, strlen(module_name))) {
> +		if (!strcmp(kmod_req->name, module_name))
>  			return kmod_req;
> -                }
> -        }
> +	}
>  
>  	return NULL;
>  }
> 
> -- 
> 2.54.0

LGTM.

Reviewed-by: Aaron Tomlin <[email protected]>

-- 
Aaron Tomlin