ACPI / watchdog: Fix off-by-one error at resource assignment
Subsystems (2)
PATCH 1/1 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.
--- drivers/acpi/acpi_watchdog.c | 4 ++-- drivers/watchdog/wdat_wdt.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/acpi_watchdog.c +2 -2
@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void) res.start = gas->address;if (gas->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) { 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 ) { res.flags =IORESOURCE_IO ; - res.end = res.start + gas->access_width; + res.end = res.start + gas->access_width -1 ; }else {pr_warn ("Unsupported address space: %u\n" , gas->space_id);
drivers/watchdog/wdat_wdt.c +1 -1
@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)memset (&r,0 ,sizeof (r)); 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 ) { r.flags =IORESOURCE_MEM ; }else if (gas->space_id ==ACPI_ADR_SPACE_SYSTEM_IO ) {
Signature · 1 line
2.16.2
Quoted 7 lines · Takashi Iwai
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 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>
Rafael J. Wysocki
AppliedQuoted 11 lines · CET Mika Westerberg
Quoted 7 lines · Takashi Iwai
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 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>Acked-by Mika Westerberg <[email protected]>--
Applied, thanks!
Quoted 7 lines · Takashi Iwai
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 058dfc767008 ("ACPI / watchdog: Add support for WDAT hardware watchdog")Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>
Quoted 38 lines
--- drivers/acpi/acpi_watchdog.c | 4 ++-- drivers/watchdog/wdat_wdt.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/acpi/acpi_watchdog.c +2
-2@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void) res.start = gas->address;if (gas->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) { 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 ) { res.flags =IORESOURCE_IO ; - res.end = res.start + gas->access_width; + res.end = res.start + gas->access_width -1 ; }else {pr_warn ("Unsupported address space: %u\n" , gas->space_id);drivers/watchdog/wdat_wdt.c +1
-1@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)memset (&r,0 ,sizeof (r)); 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 ) { r.flags =IORESOURCE_MEM ; }else if (gas->space_id ==ACPI_ADR_SPACE_SYSTEM_IO ) {Signature · 1 line
2.16.2