lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZXkbpNubH69pAjg1@MiWiFi-R3L-srv>
Date:   Wed, 13 Dec 2023 10:49:08 +0800
From:   Baoquan He <bhe@...hat.com>
To:     Yuntao Wang <ytcoode@...il.com>
Cc:     linux-kernel@...r.kernel.org, kexec@...ts.infradead.org,
        Eric Biederman <ebiederm@...ssion.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] kexec: Use ALIGN macro instead of open-coding it

On 12/12/23 at 10:27pm, Yuntao Wang wrote:
> Use ALIGN macro instead of open-coding it to improve code readability.
> 
> Signed-off-by: Yuntao Wang <ytcoode@...il.com>
> ---
>  kernel/kexec_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

LGTM,

Acked-by: Baoquan He <bhe@...hat.com>

> 
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index be5642a4ec49..0113436e4a3a 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -430,7 +430,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;
> @@ -447,7 +447,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;
>  			}
> -- 
> 2.43.0
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ