From: Matt Fleming <matt@console-pimps.org>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@zytor.com>,
Huang Ying <ying.huang@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86, efi: Only print warning when desc_size is smaller than defined one.
Date: Wed, 27 Apr 2011 12:39:35 +0100 [thread overview]
Message-ID: <20110427123935.1aacd8b9@mfleming-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <4DB74A50.3080804@kernel.org>
On Tue, 26 Apr 2011 15:42:24 -0700
Yinghai Lu <yinghai@kernel.org> wrote:
>
> One system get warning:
> Kernel-defined memdesc doesn't match the one from EFI!
>
> UEFI spec allows GetMemoryMap() return bigger desc_size and desc_ver for future
> extension.
> And desc_size is already used to get offset of next memory entry.
>
> Only need to check if desc_size is smaller than defined struct.
>
> Also print the size in warning if it happens.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/platform/efi/efi.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/arch/x86/platform/efi/efi.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/platform/efi/efi.c
> +++ linux-2.6/arch/x86/platform/efi/efi.c
> @@ -448,9 +448,10 @@ void __init efi_init(void)
> printk(KERN_ERR "Could not map the EFI memory map!\n");
> memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
>
> - if (memmap.desc_size != sizeof(efi_memory_desc_t))
> + if (memmap.desc_size < sizeof(efi_memory_desc_t))
> printk(KERN_WARNING
> - "Kernel-defined memdesc doesn't match the one from EFI!\n");
> + "Kernel-defined memdesc size is bigger than the one from EFI! %ld > %ld\n",
> + sizeof(efi_memory_desc_t), memmap.desc_size);
Does it make sense for this to just be a warning? If
sizeof(efi_memory_desec_t) > sizeof(memmap.desc_size) aren't we going
to run into some pretty serious problems when we start accessing
memory descriptors?
Would it not make more sense for this to be a BUG_ON()? In the unlikely
event that the kernel's efi_memory_desc_t is too large I really don't
see how we can recover from that.
--
Matt Fleming, Intel Open Source Technology Center
next prev parent reply other threads:[~2011-04-27 11:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-26 22:42 Yinghai Lu
2011-04-27 11:39 ` Matt Fleming [this message]
2011-04-27 17:22 ` Yinghai Lu
2011-04-28 13:05 ` Matthew Garrett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110427123935.1aacd8b9@mfleming-mobl1.ger.corp.intel.com \
--to=matt@console-pimps.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=ying.huang@intel.com \
--cc=yinghai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®