]>
Commit | Line | Data |
---|---|---|
a709ecc8 GKH |
1 | From 2060c44576c79086ff24718878d7edaa7384a985 Mon Sep 17 00:00:00 2001 |
2 | From: Alexey Starikovskiy <astarikovskiy@suse.de> | |
3 | Date: Fri, 16 Apr 2010 15:36:40 -0400 | |
4 | Subject: ACPI: EC: Limit burst to 64 bits | |
5 | ||
6 | From: Alexey Starikovskiy <astarikovskiy@suse.de> | |
7 | ||
8 | commit 2060c44576c79086ff24718878d7edaa7384a985 upstream. | |
9 | ||
10 | access_bit_width field is u8 in ACPICA, thus 256 value written to it | |
11 | becomes 0, causing divide by zero later. | |
12 | ||
13 | Proper fix would be to remove access_bit_width at all, just because | |
14 | we already have access_byte_width, which is access_bit_width / 8. | |
15 | Limit access width to 64 bit for now. | |
16 | ||
17 | https://bugzilla.kernel.org/show_bug.cgi?id=15749 | |
18 | fixes regression caused by the fix for: | |
19 | https://bugzilla.kernel.org/show_bug.cgi?id=14667 | |
20 | ||
21 | Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> | |
22 | Signed-off-by: Len Brown <len.brown@intel.com> | |
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
24 | ||
25 | --- | |
26 | drivers/acpi/acpica/exprep.c | 17 +++++++++++------ | |
27 | 1 file changed, 11 insertions(+), 6 deletions(-) | |
28 | ||
29 | --- a/drivers/acpi/acpica/exprep.c | |
30 | +++ b/drivers/acpi/acpica/exprep.c | |
31 | @@ -471,13 +471,18 @@ acpi_status acpi_ex_prep_field_value(str | |
32 | /* allow full data read from EC address space */ | |
33 | if (obj_desc->field.region_obj->region.space_id == | |
34 | ACPI_ADR_SPACE_EC) { | |
35 | - if (obj_desc->common_field.bit_length > 8) | |
36 | - obj_desc->common_field.access_bit_width = | |
37 | - ACPI_ROUND_UP(obj_desc->common_field. | |
38 | - bit_length, 8); | |
39 | + if (obj_desc->common_field.bit_length > 8) { | |
40 | + unsigned width = | |
41 | + ACPI_ROUND_BITS_UP_TO_BYTES( | |
42 | + obj_desc->common_field.bit_length); | |
43 | + // access_bit_width is u8, don't overflow it | |
44 | + if (width > 8) | |
45 | + width = 8; | |
46 | obj_desc->common_field.access_byte_width = | |
47 | - ACPI_DIV_8(obj_desc->common_field. | |
48 | - access_bit_width); | |
49 | + width; | |
50 | + obj_desc->common_field.access_bit_width = | |
51 | + 8 * width; | |
52 | + } | |
53 | } | |
54 | ||
55 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |