diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2020-04-28 10:04:32 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2020-04-28 10:04:32 +0000 |
| commit | 2779ecc2daa080829422a0a70da96e614aeeeee2 (patch) | |
| tree | e8f77d6a11703e346deb8ff9b35a2341b2141203 /sys/dev/acpi | |
| parent | b0b4bb0dbd13b0b74c3e56533b8badf564a6c613 (diff) | |
kern/55206: acpibat reporting broken by acpi_ec.c r1.81
Assume byte instead of qword alignment of the buffer passed to the EC
space handler.
Diffstat (limited to 'sys/dev/acpi')
| -rw-r--r-- | sys/dev/acpi/acpi_ec.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/acpi/acpi_ec.c b/sys/dev/acpi/acpi_ec.c index dcf8a4e5be3..6503ab5500d 100644 --- a/sys/dev/acpi/acpi_ec.c +++ b/sys/dev/acpi/acpi_ec.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_ec.c,v 1.81 2020/04/12 01:12:03 riastradh Exp $ */ +/* $NetBSD: acpi_ec.c,v 1.82 2020/04/28 10:04:32 jmcneill Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.81 2020/04/12 01:12:03 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.82 2020/04/28 10:04:32 jmcneill Exp $"); #include <sys/param.h> #include <sys/callout.h> @@ -659,32 +659,30 @@ acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr, { device_t dv; ACPI_STATUS rv; - uint8_t addr, reg; + uint8_t addr, *buf; unsigned int i; - if (paddr > 0xff || width % 8 != 0 || width > sizeof(ACPI_INTEGER)*8 || + if (paddr > 0xff || width % 8 != 0 || value == NULL || arg == NULL || paddr + width / 8 > 0x100) return AE_BAD_PARAMETER; addr = paddr; dv = arg; + buf = (uint8_t *)value; rv = AE_OK; switch (func) { case ACPI_READ: - *value = 0; - for (i = 0; i < width; i += 8, ++addr) { - rv = acpiec_read(dv, addr, ®); + for (i = 0; i < width; i += 8, ++addr, ++buf) { + rv = acpiec_read(dv, addr, buf); if (rv != AE_OK) break; - *value |= (ACPI_INTEGER)reg << i; } break; case ACPI_WRITE: - for (i = 0; i < width; i += 8, ++addr) { - reg = (*value >> i) & 0xff; - rv = acpiec_write(dv, addr, reg); + for (i = 0; i < width; i += 8, ++addr, ++buf) { + rv = acpiec_write(dv, addr, *buf); if (rv != AE_OK) break; } |
