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: <ZXkbWMzCsU5S5szm@MiWiFi-R3L-srv>
Date:   Wed, 13 Dec 2023 10:47:52 +0800
From:   Baoquan He <bhe@...hat.com>
To:     Yuntao Wang <ytcoode@...il.com>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Simon Horman <horms@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] x86/kexec: Simplify the logic of mem_region_callback()

On 12/12/23 at 11:05pm, Yuntao Wang wrote:
> The expression `mstart + resource_size(res) - 1` is actually equivalent to
> `res->end`, simplify the logic of this function to improve readability.
> 
> Signed-off-by: Yuntao Wang <ytcoode@...il.com>
> ---
>  arch/x86/kernel/machine_kexec_64.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

LGTM,

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

> 
> diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
> index 1a3e2c05a8a5..6f8df998890e 100644
> --- a/arch/x86/kernel/machine_kexec_64.c
> +++ b/arch/x86/kernel/machine_kexec_64.c
> @@ -42,12 +42,9 @@ struct init_pgtable_data {
>  static int mem_region_callback(struct resource *res, void *arg)
>  {
>  	struct init_pgtable_data *data = arg;
> -	unsigned long mstart, mend;
> -
> -	mstart = res->start;
> -	mend = mstart + resource_size(res) - 1;
>  
> -	return kernel_ident_mapping_init(data->info, data->level4p, mstart, mend);
> +	return kernel_ident_mapping_init(data->info, data->level4p,
> +					 res->start, res->end);
>  }
>  
>  static int
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ