diff options
author | Bob Moore <robert.moore@intel.com> | 2012-05-22 04:35:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2012-06-01 11:51:53 -0400 |
commit | 66be71ff477389ff12c9c43dc6ee176cf8e1dd3a (patch) | |
tree | 23ab26563ea17c99694235009e8126d358f95301 /drivers/acpi | |
parent | bd6f10a5f984e48cb56a39f2698cd58e7a33d56b (diff) |
ACPICA: Add FADT error message for GAS BitWidth overflow
Error for possible overflow during conversion from 32-bit legacy
register addresses to GAS format. The GAS struct contains a
one-byte BitWidth field, meaning that the maximum length of a
register is 255 bits. ACPICA BZ 953.
https://www.acpica.org/bugzilla/show_bug.cgi?id=953
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/tbfadt.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 4c9c760db4a4..d919f4055dba 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -49,9 +49,10 @@ | |||
49 | ACPI_MODULE_NAME("tbfadt") | 49 | ACPI_MODULE_NAME("tbfadt") |
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static ACPI_INLINE void | 52 | static void |
53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
54 | u8 space_id, u8 byte_width, u64 address); | 54 | u8 space_id, |
55 | u8 byte_width, u64 address, char *register_name); | ||
55 | 56 | ||
56 | static void acpi_tb_convert_fadt(void); | 57 | static void acpi_tb_convert_fadt(void); |
57 | 58 | ||
@@ -182,10 +183,25 @@ static struct acpi_fadt_pm_info fadt_pm_info_table[] = { | |||
182 | * | 183 | * |
183 | ******************************************************************************/ | 184 | ******************************************************************************/ |
184 | 185 | ||
185 | static ACPI_INLINE void | 186 | static void |
186 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | 187 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
187 | u8 space_id, u8 byte_width, u64 address) | 188 | u8 space_id, |
189 | u8 byte_width, u64 address, char *register_name) | ||
188 | { | 190 | { |
191 | u8 bit_width; | ||
192 | |||
193 | /* Bit width field in the GAS is only one byte long, 255 max */ | ||
194 | |||
195 | bit_width = (u8)(byte_width * 8); | ||
196 | |||
197 | if (byte_width > 31) { /* (31*8)=248 */ | ||
198 | ACPI_ERROR((AE_INFO, | ||
199 | "%s - 32-bit FADT register is too long (%u bytes, %u bits) " | ||
200 | "to convert to GAS struct - 255 bits max, truncating", | ||
201 | register_name, byte_width, (byte_width * 8))); | ||
202 | |||
203 | bit_width = 255; | ||
204 | } | ||
189 | 205 | ||
190 | /* | 206 | /* |
191 | * The 64-bit Address field is non-aligned in the byte packed | 207 | * The 64-bit Address field is non-aligned in the byte packed |
@@ -196,7 +212,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, | |||
196 | /* All other fields are byte-wide */ | 212 | /* All other fields are byte-wide */ |
197 | 213 | ||
198 | generic_address->space_id = space_id; | 214 | generic_address->space_id = space_id; |
199 | generic_address->bit_width = (u8)ACPI_MUL_8(byte_width); | 215 | generic_address->bit_width = bit_width; |
200 | generic_address->bit_offset = 0; | 216 | generic_address->bit_offset = 0; |
201 | generic_address->access_width = 0; /* Access width ANY */ | 217 | generic_address->access_width = 0; /* Access width ANY */ |
202 | } | 218 | } |
@@ -456,7 +472,8 @@ static void acpi_tb_convert_fadt(void) | |||
456 | &acpi_gbl_FADT, | 472 | &acpi_gbl_FADT, |
457 | fadt_info_table | 473 | fadt_info_table |
458 | [i].length), | 474 | [i].length), |
459 | (u64) address32); | 475 | (u64) address32, |
476 | fadt_info_table[i].name); | ||
460 | } | 477 | } |
461 | } | 478 | } |
462 | } | 479 | } |
@@ -670,7 +687,8 @@ static void acpi_tb_setup_fadt_registers(void) | |||
670 | source64->address + | 687 | source64->address + |
671 | (fadt_pm_info_table[i]. | 688 | (fadt_pm_info_table[i]. |
672 | register_num * | 689 | register_num * |
673 | pm1_register_byte_width)); | 690 | pm1_register_byte_width), |
691 | "PmRegisters"); | ||
674 | } | 692 | } |
675 | } | 693 | } |
676 | } | 694 | } |