[PATCH] kexec-tools: multiboot2: Correct BASIC_MEMINFO memory units

Simon Horman horms at verge.net.au
Tue Oct 5 01:18:32 PDT 2021


On Fri, Sep 24, 2021 at 07:03:27PM +0200, dinhngoc.tu at irit.fr wrote:
> From: Tu Dinh <dinhngoc.tu at irit.fr>
> 
> mem_lower and mem_upper are measured in kilobytes.

Thanks,

I'm curious to know how the current code could have worked.
Do we have some testing to verify this change?

> ---
>  kexec/arch/i386/kexec-mb2-x86.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kexec/arch/i386/kexec-mb2-x86.c b/kexec/arch/i386/kexec-mb2-x86.c
> index 36fef20..0d2e93b 100644
> --- a/kexec/arch/i386/kexec-mb2-x86.c
> +++ b/kexec/arch/i386/kexec-mb2-x86.c
> @@ -256,8 +256,8 @@ static uint64_t multiboot2_make_mbi(struct kexec_info *info, char *cmdline, int
>  
>  		tag->type = MULTIBOOT_TAG_TYPE_BASIC_MEMINFO;
>  		tag->size = sizeof (struct multiboot_tag_basic_meminfo);
> -		tag->mem_lower = mem_lower;
> -		tag->mem_upper = mem_upper;
> +		tag->mem_lower = mem_lower >> 10;
> +		tag->mem_upper = mem_upper >> 10;
>  		ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN) / sizeof (*ptrorig);
>  	}
>  
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 



More information about the kexec mailing list