]> git.kernelconcepts.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, 24 Aug 2011 23:46:29 +0000 (09:46 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 Sep 2011 08:18:54 +0000 (18:18 +1000)
commit3a8ef8b1cf5be2250268efa1e7c1aa79799e177d
tree7192adf8b08e0a98d897d239cd6de53b320b16aa
parent0bdfae3060441357a0d82013b121eccc8747d5c1
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