]> git.karo-electronics.de Git - karo-tx-linux.git/commit
The current implementation of dmi_name_in_vendors() is an invitation to
authorJean Delvare <khali@linux-fr.org>
Wed, 3 Aug 2011 00:52:44 +0000 (10:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 24 Aug 2011 05:24:11 +0000 (15:24 +1000)
commitc29fce076716995fd4c6c3f46890f5eb8fbd667a
tree945e98d6751dc865a2afb103e22e0cf70bb8cc93
parent5ee9ed6903004e8cd1bdc1761e76227a5ef641b6
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