]> git.karo-electronics.de Git - karo-tx-linux.git/commit
drivers/firmware/dmi_scan.c: make dmi_name_in_vendors more focused
authorJean Delvare <khali@linux-fr.org>
Mon, 24 Oct 2011 14:53:47 +0000 (01:53 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 7 Nov 2011 02:40:22 +0000 (13:40 +1100)
commitf9def67091ed2c3095a1ce149d3bc58f7a272a38
tree3cdbc70fbe12ead163c0accad384c1c1c3bb30af
parentafdb1960d1839b06b30fb7868c656f59415f7a98
drivers/firmware/dmi_scan.c: make dmi_name_in_vendors more focused

The current implementation of dmi_name_in_vendors() is an invitation to
lazy coding and false positives [1].  Searching for a string in 8 know
what you're looking for, so you should know where to look.  strstr isn't
fast, especially when it fails, so we should avoid calling it when it just
can't succeed.

Looking at the current users of the function, it seems clear to me that
they are looking for a system or board vendor name, so let's limit
dmi_name_in_vendors to these two DMI fields.  This much better matches the
function name, BTW.

[1] We currently have code looking for short names in DMI data, such
as "IBM", "ASUS" or "Acer". I let you guess what will happen the day
other vendors ship products named, for example, "SCHREIBMEISTER",
"PEGASUS" or "Acerola".

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/firmware/dmi_scan.c