lkml.org 
[lkml]   [2008]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] Check for serial key in dmi_name_in_vendors
Alok Kataria wrote:
> Add serial key as a field to check for in dmi_name_in_vendors.
>
> From: Alok N Kataria <akataria@vmware.com>
>
> In some user configured cases, VMware may choose not to put a VMware specific
> DMI string, but the serial key is always there and is VMware specific.
> Add that too to check for in the dmi_name_in_vendors function.
>
> Signed-off-by: Alok N Kataria <akataria@vmware.com>
> ---
>
> drivers/firmware/dmi_scan.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
>
> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> index 3e526b6..14fcb52 100644
> --- a/drivers/firmware/dmi_scan.c
> +++ b/drivers/firmware/dmi_scan.c
> @@ -476,7 +476,8 @@ int dmi_name_in_vendors(const char *str)
> {
> static int fields[] = { DMI_BIOS_VENDOR, DMI_BIOS_VERSION, DMI_SYS_VENDOR,
> DMI_PRODUCT_NAME, DMI_PRODUCT_VERSION, DMI_BOARD_VENDOR,
> - DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_NONE };
> + DMI_BOARD_NAME, DMI_BOARD_VERSION, DMI_PRODUCT_SERIAL,
> + DMI_NONE };
> int i;
> for (i = 0; fields[i] != DMI_NONE; i++) {
> int f = fields[i];
>

On reviewing this, I'm quite nervous about this patch.
dmi_name_in_vendors() is matched against short strings like "IBM" which
could end up in the serial number of another product by pure chance if
some vendor uses alpha serial numbers.

In fact, the *only* instance of dmi_name_in_vendors() in the upstream
kernel tree that "git grep" can find is:

drivers/misc/thinkpad_acpi.c: if (dmi_name_in_vendors("IBM"))
drivers/misc/thinkpad_acpi.c: else if (dmi_name_in_vendors("LENOVO"))

I think matching against the serial number would be just plain wrong here.

Since there is only one user, we could change that user, perhaps to take
a bitmask or pointer to one of several canned lists as an argument, or
we can introduce another entry point.

-hpa


\
 
 \ /
  Last update: 2008-10-31 23:53    [W:0.127 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site