public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yinghai@kernel.org>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Thomas Gleixner" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: x86: fix macro with bad_bios_dmi_table
Date: Tue, 23 Sep 2008 01:30:26 -0700	[thread overview]
Message-ID: <86802c440809230130n44ce9dechbe6b10ffe4685ee5@mail.gmail.com> (raw)
In-Reply-To: <20080923081650.GA19003@elte.hu>

On Tue, Sep 23, 2008 at 1:16 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
>> need one blank tail.
>>
>> fix the crash on ingo's test box.
>
> applied to tip/x86/memory-corruption-check, thanks Yinghai!
>
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -760,8 +760,8 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
>>                       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
>>               },
>>       },
>> -     {}
>>  #endif
>> +     {}
>>  };
>
> i've seen such DMI crashes numerous times, caused by a missing NULL at
> the end of the table. Is there no sane way to detect or robustly avoid
> such run-off-the-end bugs?
>
> how about changing dmi_check_system(table) to a macro, which does
> something like:
>
>   __dmi_check_system(&(table), sizeof(table))

ARRAY_SIZE()

>
> and rename dmi_check_system() in drivers/firmware/dmi_scan.c to
> __dmi_check_system() and add the size parameter? That way we could
> remove the need for NULL termination and it's even a size optimization:
> it shrinks those tables a tiny bit.

# git grep dmi_system_id | grep "\[" | wc -l
62

YH

  reply	other threads:[~2008-09-23  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23  7:35 x86: fix macro with bad_bios_dmi_table Yinghai Lu
2008-09-23  8:16 ` Ingo Molnar
2008-09-23  8:30   ` Yinghai Lu [this message]
2008-09-23  8:33     ` Ingo Molnar

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=86802c440809230130n44ce9dechbe6b10ffe4685ee5@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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