Use strcmp() instead of strlen()+memcmp() to compare module names in kmod_dup_request_lookup(), since all strings are NUL-terminated.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -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 | } |