ACPI: EC: Limit burst to 64 bits

access_bit_width field is u8 in ACPICA, thus 256 value written to it
becomes 0, causing divide by zero later.

Proper fix would be to remove access_bit_width at all, just because
we already have access_byte_width, which is access_bit_width / 8.
Limit access width to 64 bit for now.

https://bugzilla.kernel.org/show_bug.cgi?id=15749
fixes regression caused by the fix for:
https://bugzilla.kernel.org/show_bug.cgi?id=14667

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by Alexey Starikovskiy and committed by Len Brown 2060c445 dadf28a1

+11 -6
+11 -6
drivers/acpi/acpica/exprep.c
··· 471 471 /* allow full data read from EC address space */ 472 472 if (obj_desc->field.region_obj->region.space_id == 473 473 ACPI_ADR_SPACE_EC) { 474 - if (obj_desc->common_field.bit_length > 8) 475 - obj_desc->common_field.access_bit_width = 476 - ACPI_ROUND_UP(obj_desc->common_field. 477 - bit_length, 8); 474 + if (obj_desc->common_field.bit_length > 8) { 475 + unsigned width = 476 + ACPI_ROUND_BITS_UP_TO_BYTES( 477 + obj_desc->common_field.bit_length); 478 + // access_bit_width is u8, don't overflow it 479 + if (width > 8) 480 + width = 8; 478 481 obj_desc->common_field.access_byte_width = 479 - ACPI_DIV_8(obj_desc->common_field. 480 - access_bit_width); 482 + width; 483 + obj_desc->common_field.access_bit_width = 484 + 8 * width; 485 + } 481 486 } 482 487 483 488 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,