summaryrefslogtreecommitdiffstats
path: root/kernel/kexec_core.c
diff options
context:
space:
mode:
authorYuntao Wang <ytcoode@gmail.com>2023-12-12 22:27:06 +0800
committerAndrew Morton <akpm@linux-foundation.org>2023-12-20 15:02:58 -0800
commitdb6b6fb70193f0defe4d5785e940156c06e9abbe (patch)
tree764e99d0c70dfb410a9d4307ae52215f1834efad /kernel/kexec_core.c
parente95d392d160baa2fbc1c0cac672abc472985418b (diff)
downloadlinux-db6b6fb70193f0defe4d5785e940156c06e9abbe.tar.gz
linux-db6b6fb70193f0defe4d5785e940156c06e9abbe.tar.bz2
linux-db6b6fb70193f0defe4d5785e940156c06e9abbe.zip
kexec: use ALIGN macro instead of open-coding it
Use ALIGN macro instead of open-coding it to improve code readability. Link: https://lkml.kernel.org/r/20231212142706.25149-1-ytcoode@gmail.com Signed-off-by: Yuntao Wang <ytcoode@gmail.com> Acked-by: Baoquan He <bhe@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel/kexec_core.c')
-rw-r--r--kernel/kexec_core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 64072acef2b6..6e0f022987ff 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -432,7 +432,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
pages = NULL;
size = (1 << order) << PAGE_SHIFT;
- hole_start = (image->control_page + (size - 1)) & ~(size - 1);
+ hole_start = ALIGN(image->control_page, size);
hole_end = hole_start + size - 1;
while (hole_end <= crashk_res.end) {
unsigned long i;
@@ -449,7 +449,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
mend = mstart + image->segment[i].memsz - 1;
if ((hole_end >= mstart) && (hole_start <= mend)) {
/* Advance the hole to the end of the segment */
- hole_start = (mend + (size - 1)) & ~(size - 1);
+ hole_start = ALIGN(mend, size);
hole_end = hole_start + size - 1;
break;
}