[PATCH 4/5] module/dups: Use strcmp() to compare module names

From: Petr Pavlu

Date: Mon Jul 20 2026 - 08:22:05 EST


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 <petr.pavlu@xxxxxxxx>
---
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 a62619ec057e..43cec4cec4fd 100644
--- a/kernel/module/dups.c
+++ b/kernel/module/dups.c
@@ -70,11 +70,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