History

module/dups: Use strcmp() to compare module names

Use strcmp() instead of strlen()+memcmp() to compare module names in kmod_dup_request_lookup(), since all strings are NUL-terminated.

Petr Pavlu committed 3 months ago

Commit cc6e79b1 parent c85e7651 file · +2 −4Browse files

Unified · Split

kernel/module/dups.c+2−4
@@ -72,11 +72,9 @@ static struct kmod_dup_req *kmod_dup_request_lookup(char *module_name) · 71 unmodified lines
72 lockdep_assert_held(&kmod_dup_mutex);72 lockdep_assert_held(&kmod_dup_mutex);
73 73
74 list_for_each_entry(kmod_req, &dup_kmod_reqs, list) {74 list_for_each_entry(kmod_req, &dup_kmod_reqs, list) {
75 if (strlen(kmod_req->name) == strlen(module_name) &&75 if (!strcmp(kmod_req->name, module_name))
76 !memcmp(kmod_req->name, module_name, strlen(module_name))) {
77 return kmod_req;76 return kmod_req;
78 }77 }
79 }
80 78
81 return NULL;79 return NULL;
82}80}