From: Leizhen Zhang <lzsx618@gmail.com>
To: dhowells@redhat.com, dwmw2@infradead.org, akpm@linux-foundation.org
Cc: keyrings@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2] insert-sys-cert: fix use of uninitialized pointer with an empty System.map
Date: Thu, 8 Oct 2026 11:41:37 -0500 [thread overview]
Message-ID: <20261008164137.3671294-1-lzsx618@gmail.com> (raw)
get_symbol_from_map() only assigns n inside the loop that reads the
System.map file. If the file is empty, the loop body never runs and n is
then tested while uninitialized, as reported by MemorySanitizer.
Initialize n to NULL.
Fixes: c4c361059585 ("KEYS: Reserve an extra certificate symbol for inserting without recompiling")
Assisted-by: Claude:claude-opus-5-5 MSan
Signed-off-by: Leizhen Zhang <lzsx618@gmail.com>
---
v2:
- Use my real name in the From and Signed-off-by lines. No code
changes.
v1: https://lore.kernel.org/r/20261005104217.1788155-1-lzsx618@gmail.com
scripts/insert-sys-cert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/insert-sys-cert.c b/scripts/insert-sys-cert.c
index 8902836c23..e0bf0afc1b 100644
--- a/scripts/insert-sys-cert.c
+++ b/scripts/insert-sys-cert.c
@@ -94,7 +94,7 @@ static void get_symbol_from_map(Elf_Ehdr *hdr, FILE *f, char *name,
struct sym *s)
{
char l[LINE_SIZE];
- char *w, *p, *n;
+ char *w, *p, *n = NULL;
s->size = 0;
s->address = 0;
--
2.34.1
reply other threads:[~2026-10-08 16:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261008164137.3671294-1-lzsx618@gmail.com \
--to=lzsx618@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®