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

Showing the changes to kernel/module (1 of 1 file). Show all

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
7272 lockdep_assert_held(&kmod_dup_mutex);
7373
7474 list_for_each_entry(kmod_req, &dup_kmod_reqs, list) {
75− if (strlen(kmod_req->name) == strlen(module_name) &&
76− !memcmp(kmod_req->name, module_name, strlen(module_name))) {
75+ if (!strcmp(kmod_req->name, module_name))
7776 return kmod_req;
78− }
79− }
77+ }
8078
8179 return NULL;
8280 }