Skip to content

Commit 46a5b29

Browse files
nivedita76ingomolnar
authored andcommitted
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
1 parent d6d0f36 commit 46a5b29

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

arch/x86/boot/compressed/kaslr.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,10 @@ static void store_slot_info(struct mem_vector *region, unsigned long image_size)
525525
return;
526526

527527
slot_area.addr = region->start;
528-
slot_area.num = (region->size - image_size) /
529-
CONFIG_PHYSICAL_ALIGN + 1;
528+
slot_area.num = 1 + (region->size - image_size) / CONFIG_PHYSICAL_ALIGN;
530529

531-
if (slot_area.num > 0) {
532-
slot_areas[slot_area_index++] = slot_area;
533-
slot_max += slot_area.num;
534-
}
530+
slot_areas[slot_area_index++] = slot_area;
531+
slot_max += slot_area.num;
535532
}
536533

537534
/*

0 commit comments

Comments
 (0)