From: Siddharth Nayyar <sidnayyar@google.com>
To: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas.schier@linux.dev>,
Siddharth Nayyar <sidnayyar@google.com>
Subject: [PATCH] modpost: check for NULL filename pointer in find_module()
Date: Sun, 6 Jul 2025 21:09:40 +0000 [thread overview]
Message-ID: <20250706210940.1720720-1-sidnayyar@google.com> (raw)
Pointer for dump filename can be NULL when a module is not created from
a dump file in modpost. The find_module() function should therefore
check whether the dump filename pointers are NULL before comparing them
using strcmp().
Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>
---
scripts/mod/modpost.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 5ca7c268294e..9a64d0a55f89 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -178,8 +178,12 @@ static struct module *find_module(const char *filename, const char *modname)
struct module *mod;
list_for_each_entry(mod, &modules, list) {
- if (!strcmp(mod->dump_file, filename) &&
- !strcmp(mod->name, modname))
+ if (strcmp(mod->name, modname) != 0)
+ continue;
+ if (!mod->dump_file && !filename)
+ return mod;
+ if (mod->dump_file && filename &&
+ !strcmp(mod->dump_file, filename))
return mod;
}
return NULL;
--
2.50.0.727.gbf7dc18ff4-goog
next reply other threads:[~2025-07-06 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-06 21:09 Siddharth Nayyar [this message]
2025-07-07 10:24 ` Masahiro Yamada
2025-07-07 12:34 ` Sid Nayyar
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=20250706210940.1720720-1-sidnayyar@google.com \
--to=sidnayyar@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas.schier@linux.dev \
/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®