]> git.baikalelectronics.ru Git - kernel.git/commit
x86/kaslr: Drop unnecessary alignment in find_random_virt_addr()
authorArvind Sankar <nivedita@alum.mit.edu>
Tue, 28 Jul 2020 22:57:17 +0000 (18:57 -0400)
committerIngo Molnar <mingo@kernel.org>
Fri, 31 Jul 2020 09:08:17 +0000 (11:08 +0200)
commitb0287cdc647e7f01c0701e94f5d194778358d01d
tree58a66e171b6ae4fdba562ccc3b26c941fc6e3c6a
parent2867bce78bf887cac9b595d9ec9a7698b2ef56c4
x86/kaslr: Drop unnecessary alignment in find_random_virt_addr()

Drop unnecessary alignment of image_size to CONFIG_PHYSICAL_ALIGN in
find_random_virt_addr, it cannot change the result: the largest valid
slot is the largest n that satisfies

  minimum + n * CONFIG_PHYSICAL_ALIGN + image_size <= KERNEL_IMAGE_SIZE

(since minimum is already aligned) and so n is equal to

  (KERNEL_IMAGE_SIZE - minimum - image_size) / CONFIG_PHYSICAL_ALIGN

even if image_size is not aligned to CONFIG_PHYSICAL_ALIGN.

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-17-nivedita@alum.mit.edu
arch/x86/boot/compressed/kaslr.c