Commit b1abf6fc authored by Takashi Iwai's avatar Takashi Iwai Committed by Rafael J. Wysocki

ACPI / watchdog: Fix off-by-one error at resource assignment

The resource allocation in WDAT watchdog has off-one-by error, it sets
one byte more than the actual end address.  This may eventually lead
to unexpected resource conflicts.

Fixes: 058dfc76 (ACPI / watchdog: Add support for WDAT hardware watchdog)
Cc: 4.9+ <stable@vger.kernel.org> # 4.9+
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent c698ca52
...@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void) ...@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void)
res.start = gas->address; res.start = gas->address;
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
res.flags = IORESOURCE_MEM; res.flags = IORESOURCE_MEM;
res.end = res.start + ALIGN(gas->access_width, 4); res.end = res.start + ALIGN(gas->access_width, 4) - 1;
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
res.flags = IORESOURCE_IO; res.flags = IORESOURCE_IO;
res.end = res.start + gas->access_width; res.end = res.start + gas->access_width - 1;
} else { } else {
pr_warn("Unsupported address space: %u\n", pr_warn("Unsupported address space: %u\n",
gas->space_id); gas->space_id);
......
...@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev) ...@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
memset(&r, 0, sizeof(r)); memset(&r, 0, sizeof(r));
r.start = gas->address; r.start = gas->address;
r.end = r.start + gas->access_width; r.end = r.start + gas->access_width - 1;
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
r.flags = IORESOURCE_MEM; r.flags = IORESOURCE_MEM;
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment