From: Daniil Dulov <d.dulov@aladdin.ru>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniil Dulov <d.dulov@aladdin.ru>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>, <x86@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>, Baoquan He <bhe@redhat.com>,
Kees Cook <keescook@chromium.org>, <linux-kernel@vger.kernel.org>,
<lvc-project@linuxtesting.org>
Subject: [PATCH] x86/kaslr: Fix potential dereference of NULL pointer.
Date: Mon, 17 Apr 2023 23:53:08 -0700 [thread overview]
Message-ID: <20230418065308.452462-1-d.dulov@aladdin.ru> (raw)
Pointer val can have NULL value. Then its value is assigned to the pointer p.
p is dereferenced by calling strcmp().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 4cdba14f84c9 ("x86/KASLR: Handle the memory limit specified by the 'memmap=' and 'mem=' boot options")
Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
---
arch/x86/boot/compressed/kaslr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index b92fffbe761f..51b3925d4d2d 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -291,7 +291,7 @@ static void handle_mem_options(void)
} else if (!strcmp(param, "mem")) {
char *p = val;
- if (!strcmp(p, "nopentium"))
+ if (!p || !strcmp(p, "nopentium"))
continue;
mem_size = memparse(p, &p);
if (mem_size == 0)
--
2.25.1
next reply other threads:[~2023-04-18 6:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 6:53 Daniil Dulov [this message]
2023-04-18 7:43 ` Baoquan He
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=20230418065308.452462-1-d.dulov@aladdin.ru \
--to=d.dulov@aladdin.ru \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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®