Commit db6b6fb7 authored by Yuntao Wang's avatar Yuntao Wang Committed by Andrew Morton

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.comSigned-off-by: default avatarYuntao Wang <ytcoode@gmail.com>
Acked-by: default avatarBaoquan He <bhe@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent e95d392d
...@@ -432,7 +432,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, ...@@ -432,7 +432,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
pages = NULL; pages = NULL;
size = (1 << order) << PAGE_SHIFT; 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; hole_end = hole_start + size - 1;
while (hole_end <= crashk_res.end) { while (hole_end <= crashk_res.end) {
unsigned long i; unsigned long i;
...@@ -449,7 +449,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image, ...@@ -449,7 +449,7 @@ static struct page *kimage_alloc_crash_control_pages(struct kimage *image,
mend = mstart + image->segment[i].memsz - 1; mend = mstart + image->segment[i].memsz - 1;
if ((hole_end >= mstart) && (hole_start <= mend)) { if ((hole_end >= mstart) && (hole_start <= mend)) {
/* Advance the hole to the end of the segment */ /* 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; hole_end = hole_start + size - 1;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment