aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/compressed/kaslr.c
diff options
context:
space:
mode:
authorArvind Sankar <nivedita@alum.mit.edu>2020-07-28 18:57:16 -0400
committerIngo Molnar <mingo@kernel.org>2020-07-31 11:08:17 +0200
commit46a5b29a4a63a3ba987cbb5467774a4b5787618e (patch)
tree3faa87c4a87a36f7fc23303717b775bec735507d /arch/x86/boot/compressed/kaslr.c
parentx86/kaslr: Make the type of number of slots/slot areas consistent (diff)
downloadlinux-dev-46a5b29a4a63a3ba987cbb5467774a4b5787618e.tar.xz
linux-dev-46a5b29a4a63a3ba987cbb5467774a4b5787618e.zip
x86/kaslr: Drop redundant check in store_slot_info()
Drop unnecessary check that number of slots is not zero in store_slot_info, it's guaranteed to be at least 1 by the calculation. Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20200728225722.67457-16-nivedita@alum.mit.edu
Diffstat (limited to 'arch/x86/boot/compressed/kaslr.c')
-rw-r--r--arch/x86/boot/compressed/kaslr.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 5c7457cc58f6..0c64026a0951 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -525,13 +525,10 @@ static void store_slot_info(struct mem_vector *region, unsigned long image_size)
return;
slot_area.addr = region->start;
- slot_area.num = (region->size - image_size) /
- CONFIG_PHYSICAL_ALIGN + 1;
+ slot_area.num = 1 + (region->size - image_size) / CONFIG_PHYSICAL_ALIGN;
- if (slot_area.num > 0) {
- slot_areas[slot_area_index++] = slot_area;
- slot_max += slot_area.num;
- }
+ slot_areas[slot_area_index++] = slot_area;
+ slot_max += slot_area.num;
}
/*