diff options
Diffstat (limited to 'drivers/acpi/tables/tbfind.c')
-rw-r--r-- | drivers/acpi/tables/tbfind.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/acpi/tables/tbfind.c b/drivers/acpi/tables/tbfind.c index 058c064948e1..9ca3afc98c80 100644 --- a/drivers/acpi/tables/tbfind.c +++ b/drivers/acpi/tables/tbfind.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -70,12 +70,22 @@ acpi_tb_find_table(char *signature, | |||
70 | { | 70 | { |
71 | acpi_native_uint i; | 71 | acpi_native_uint i; |
72 | acpi_status status; | 72 | acpi_status status; |
73 | struct acpi_table_header header; | ||
73 | 74 | ||
74 | ACPI_FUNCTION_TRACE(tb_find_table); | 75 | ACPI_FUNCTION_TRACE(tb_find_table); |
75 | 76 | ||
77 | /* Normalize the input strings */ | ||
78 | |||
79 | ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header)); | ||
80 | ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE); | ||
81 | ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); | ||
82 | ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); | ||
83 | |||
84 | /* Search for the table */ | ||
85 | |||
76 | for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { | 86 | for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { |
77 | if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), | 87 | if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), |
78 | signature, ACPI_NAME_SIZE)) { | 88 | header.signature, ACPI_NAME_SIZE)) { |
79 | 89 | ||
80 | /* Not the requested table */ | 90 | /* Not the requested table */ |
81 | 91 | ||
@@ -104,20 +114,24 @@ acpi_tb_find_table(char *signature, | |||
104 | 114 | ||
105 | if (!ACPI_MEMCMP | 115 | if (!ACPI_MEMCMP |
106 | (acpi_gbl_root_table_list.tables[i].pointer->signature, | 116 | (acpi_gbl_root_table_list.tables[i].pointer->signature, |
107 | signature, ACPI_NAME_SIZE) && (!oem_id[0] | 117 | header.signature, ACPI_NAME_SIZE) && (!oem_id[0] |
108 | || | 118 | || |
109 | !ACPI_MEMCMP | 119 | !ACPI_MEMCMP |
110 | (acpi_gbl_root_table_list. | 120 | (acpi_gbl_root_table_list. |
111 | tables[i].pointer->oem_id, | 121 | tables[i].pointer-> |
112 | oem_id, ACPI_OEM_ID_SIZE)) | 122 | oem_id, |
123 | header.oem_id, | ||
124 | ACPI_OEM_ID_SIZE)) | ||
113 | && (!oem_table_id[0] | 125 | && (!oem_table_id[0] |
114 | || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. | 126 | || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. |
115 | pointer->oem_table_id, oem_table_id, | 127 | pointer->oem_table_id, |
128 | header.oem_table_id, | ||
116 | ACPI_OEM_TABLE_ID_SIZE))) { | 129 | ACPI_OEM_TABLE_ID_SIZE))) { |
117 | *table_index = i; | 130 | *table_index = i; |
118 | 131 | ||
119 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 132 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
120 | "Found table [%4.4s]\n", signature)); | 133 | "Found table [%4.4s]\n", |
134 | header.signature)); | ||
121 | return_ACPI_STATUS(AE_OK); | 135 | return_ACPI_STATUS(AE_OK); |
122 | } | 136 | } |
123 | } | 137 | } |