From: Thorsten Blum <thorsten.blum@linux.dev>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Thorsten Blum <thorsten.blum@linux.dev>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH v4] x86/kaslr: Remove redundant if check in slots_fetch_random()
Date: Tue, 4 Aug 2026 18:35:36 +0200 [thread overview]
Message-ID: <20260804163536.142495-2-thorsten.blum@linux.dev> (raw)
The loop in slots_fetch_random() either returns the slot address or
exits with i == slot_area_index, making the if check redundant. Drop it.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
Changes in v4:
- Drop the change in choose_random_location()
- Reword subject and patch description
- v3: https://lore.kernel.org/r/20260802093531.7165-2-thorsten.blum@linux.dev/
Changes in v3:
- Name commit 8391c73c96f2 that added the check (Boris)
- Keep the comment (Boris)
- v2: https://lore.kernel.org/r/20260731073933.685882-3-thorsten.blum@linux.dev/
Changes in v2:
- Explain why the check in choose_random_location() is redundant (Boris)
- Reword subject
- v1: https://lore.kernel.org/r/20260714205752.133163-2-thorsten.blum@linux.dev/
---
arch/x86/boot/compressed/kaslr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 81e21c76cbb8..34ee7700ab85 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -541,8 +541,7 @@ static u64 slots_fetch_random(void)
return slot_areas[i].addr + ((u64)slot * CONFIG_PHYSICAL_ALIGN);
}
- if (i == slot_area_index)
- debug_putstr("slots_fetch_random() failed!?\n");
+ debug_putstr("slots_fetch_random() failed!?\n");
return 0;
}
reply other threads:[~2026-08-04 16:35 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=20260804163536.142495-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--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