Re: memcpy_fromio in dmi_scan.c
From: Andrew Morton
Date: Thu Apr 25 2013 - 16:37:13 EST
On Thu, 25 Apr 2013 04:52:42 -0500 Robin Holt <holt@xxxxxxx> wrote:
> On Wed, Apr 24, 2013 at 09:07:24PM -0500, Robin Holt wrote:
> > On Wed, Apr 24, 2013 at 08:16:50PM +0000, Luck, Tony wrote:
> > > > That being said, "my" SN2 machine was previously running kernel 3.0.34
> > > > which has the old dmi_scan code and it also said "DMI not present or
> > > > invalid." Plus dmidecode fails on this machine with:
> > > >
> > > > /sys/firmware/efi/systab: SMBIOS entry point missing
> > > >
> > > > So it might as well be that DMI support on SN2 was already broken.
> > > > Please let me know your findings on other SN2 machines.
> > >
> > > I don't have an sn2 to test. Added Robin Holt to Cc list
> >
> > I will try and boot an sn2 machine first thing tomorrow morning.
> > I don't recall dmidecode being broken, but that was quite a while ago.
> > I thought the license validation code we used on sn2 used data from the
> > dmidecode output.
>
> # uname -r
> 3.0.13-0.27-default
> # dmidecode
> # dmidecode 2.9
> /sys/firmware/efi/systab: SMBIOS entry point missing
>
>
> It looks like it is broken there as well. This is running a SLES11SP2
> kernel with no local changes.
>
> dmesg show:
> DMI not present or invalid.
>
So what's the fix? This?
--- a/drivers/firmware/dmi_scan.c~a
+++ a/drivers/firmware/dmi_scan.c
@@ -500,9 +500,12 @@ void __init dmi_scan_machine(void)
goto error;
for (q = p; q < p + 0x10000; q += 16) {
- if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0)
+ char buf[5];
+
+ memcpy_from_io(buf, q, 5);
+ if (memcmp(buf, "_SM_", 4) == 0 && q - p <= 0xFFE0)
rc = smbios_present(q);
- else if (memcmp(q, "_DMI_", 5) == 0)
+ else if (memcmp(buf, "_DMI_", 5) == 0)
rc = dmi_present(q);
else
continue;
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/