From: Petr Pavlu <petr.pavlu@suse.com>
To: Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Daniel Gomez <da.gomez@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>
Cc: Aaron Tomlin <atomlin@atomlin.com>,
linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 5/6] module/dups: Use strcmp() to compare module names
Date: Thu, 23 Jul 2026 10:25:55 +0200 [thread overview]
Message-ID: <20260723-module-stats-rcu-v2-5-bd582261fae3@suse.com> (raw)
In-Reply-To: <20260723-module-stats-rcu-v2-0-bd582261fae3@suse.com>
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@suse.com>
---
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
next prev parent reply other threads:[~2026-07-23 8:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 8:25 [PATCH v2 0/6] module/dups: Fix a use-after-free and improve the code Petr Pavlu
2026-07-23 8:25 ` [PATCH v2 1/6] module/dups: Inform duplicate requests about the result directly Petr Pavlu
2026-07-23 8:25 ` [PATCH v2 2/6] module/dups: Fix use-after-free in kmod_dup_req lifetime handling Petr Pavlu
2026-07-24 2:50 ` Aaron Tomlin
2026-07-23 8:25 ` [PATCH v2 3/6] module/dups: Avoid unnecessary kmod_dup_req allocations Petr Pavlu
2026-07-24 2:53 ` Aaron Tomlin
2026-07-23 8:25 ` [PATCH v2 4/6] module/dups: Use scope-based cleanup helpers Petr Pavlu
2026-07-23 8:25 ` Petr Pavlu [this message]
2026-07-25 16:30 ` [PATCH v2 5/6] module/dups: Use strcmp() to compare module names Aaron Tomlin
2026-07-23 8:25 ` [PATCH v2 6/6] module/dups: Clean up includes Petr Pavlu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723-module-stats-rcu-v2-5-bd582261fae3@suse.com \
--to=petr.pavlu@suse.com \
--cc=atomlin@atomlin.com \
--cc=da.gomez@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=samitolvanen@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®