Re: [PATCH 4/8] DMI: Parse memory device (type 17) in SMBIOS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 11, 2013 at 05:40:48PM +0200, Borislav Petkov wrote:
> Date: Fri, 11 Oct 2013 17:40:48 +0200
> From: Borislav Petkov <bp@xxxxxxxxx>
> To: "Chen, Gong" <gong.chen@xxxxxxxxxxxxxxx>
> Cc: tony.luck@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx,
>  linux-acpi@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH 4/8] DMI: Parse memory device (type 17) in SMBIOS
> User-Agent: Mutt/1.5.21 (2010-09-15)
> 
> On Fri, Oct 11, 2013 at 02:32:42AM -0400, Chen, Gong wrote:
> > This patch adds a new interface to decode memory device (type 17)
> > to help error reporting on DIMMs.
> > 
> > Original-author: Tony Luck <tony.luck@xxxxxxxxx>
> > Signed-off-by: Chen, Gong <gong.chen@xxxxxxxxxxxxxxx>
> 
> Reviewed-by: Borislav Petkov <bp@xxxxxxx>
> 
> Just a question below:
> 
> > ---
> >  arch/ia64/kernel/setup.c    |  1 +
> >  arch/x86/kernel/setup.c     |  1 +
> >  drivers/firmware/dmi_scan.c | 60 +++++++++++++++++++++++++++++++++++++++++++++
> >  include/linux/dmi.h         |  5 ++++
> >  4 files changed, 67 insertions(+)
> > 
> 
> [ ... ]
> 
> > diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> > index fa0affb..ca3619d 100644
> > --- a/drivers/firmware/dmi_scan.c
> > +++ b/drivers/firmware/dmi_scan.c
> > @@ -25,6 +25,13 @@ static int dmi_initialized;
> >  /* DMI system identification string used during boot */
> >  static char dmi_ids_string[128] __initdata;
> >  
> > +static struct dmi_memdev_info {
> > +	const char *device;
> > +	const char *bank;
> > +	u16 handle;
> > +} *dmi_memdev;
> > +static int dmi_memdev_nr;
> > +
> >  static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s)
> >  {
> >  	const u8 *bp = ((u8 *) dm) + dm->length;
> > @@ -322,6 +329,42 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
> >  	dmi_save_one_device(*d & 0x7f, dmi_string_nosave(dm, *(d - 1)));
> >  }
> >  
> > +static void __init count_mem_devices(const struct dmi_header *dm, void *v)
> > +{
> > +	if (dm->type != DMI_ENTRY_MEM_DEVICE)
> > +		return;
> > +	dmi_memdev_nr++;
> > +}
> > +
> > +static void __init save_mem_devices(const struct dmi_header *dm, void *v)
> > +{
> > +	const char *d = (const char *)dm;
> > +	static int nr;
> > +
> > +	if (dm->type != DMI_ENTRY_MEM_DEVICE)
> > +		return;
> > +	if (nr >= dmi_memdev_nr) {
> > +		pr_warn_once("Too many DIMM entries in SMBIOS table\n");
> > +		return;
> 
> Is this and count_mem_devices() some sort of precaution against insane
> DMI tables?
> 

Yes, but we highly expect BIOS manufactors to make is valid and complete.
> -- 
> Regards/Gruss,
>     Boris.
> 
> Sent from a fat crate under my desk. Formatting is fine.
> --

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux