Re: Suspect loop in dmi_scan_machine()

From: Jean Delvare
Date: Tue Jul 09 2013 - 04:36:39 EST


Hi Ben,

Le Monday 08 July 2013 Ã 17:33 +0100, Ben Hutchings a Ãcrit :
> On Mon, Jul 08, 2013 at 05:49:14PM +0200, Jean Delvare wrote:
> > I am looking at this commit of yours:
> >
> > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/firmware/dmi_scan.c?id=79bae42d51a5d498500c890c19ef76df41d2bf59
> >
> > and am a little worried about the for loop in dmi_scan_machine()
> > (non-EFI case):
> [...]
>
> I don't see any of the bugs you describe. Let me explain what
> I probably should have put in a comment:
>
> We want to find a DMI header at [0xf0000, 0xffff0] and possibly an
> SMBIOS header 16 bytes before that. buf contains a copy of the 32
> bytes centred at p. On the first iteration p - 16 is out of range, so
> the first 16 bytes of the buffer are filled with zeroes.
>
> Does that address your concerns? If not then please explain precisely
> how this loop can go wrong.

Wow. I'm not sure what I was up to yesterday evening but I definitely
should have waited a bit before posting. I read your code again this
morning and it is completely correct, and the concerns I raised
yesterday were plain crap. I suppose your code was too smart for my
tired brain...

Sorry for the noise,
--
Jean Delvare
Suse L3

--
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/