* [PATCH 1/1] ACPI: resource: Fix memory resource type union access
@ 2024-12-02 10:06 Ilpo Järvinen
2024-12-09 20:31 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Ilpo Järvinen @ 2024-12-02 10:06 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Jiang Liu, Thomas Gleixner,
linux-acpi, linux-kernel
Cc: Ilpo Järvinen
In acpi_decode_space() addr->info.mem.caching is checked on main level
for any resource type but addr->info.mem is part of union and thus
valid only if the resource type is memory range.
Move the check inside the preceeding switch/case to only execute it
when the union is of correct type.
Fixes: fcb29bbcd540 ("ACPI: Add prefetch decoding to the address space parser")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
I only came across this while reading code around these parts (not
because of investigating some issue).
drivers/acpi/resource.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 7fe842dae1ec..821867de43be 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -250,6 +250,9 @@ static bool acpi_decode_space(struct resource_win *win,
switch (addr->resource_type) {
case ACPI_MEMORY_RANGE:
acpi_dev_memresource_flags(res, len, wp);
+
+ if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
+ res->flags |= IORESOURCE_PREFETCH;
break;
case ACPI_IO_RANGE:
acpi_dev_ioresource_flags(res, len, iodec,
@@ -265,9 +268,6 @@ static bool acpi_decode_space(struct resource_win *win,
if (addr->producer_consumer == ACPI_PRODUCER)
res->flags |= IORESOURCE_WINDOW;
- if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
- res->flags |= IORESOURCE_PREFETCH;
-
return !(res->flags & IORESOURCE_DISABLED);
}
--
2.39.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] ACPI: resource: Fix memory resource type union access
2024-12-02 10:06 [PATCH 1/1] ACPI: resource: Fix memory resource type union access Ilpo Järvinen
@ 2024-12-09 20:31 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2024-12-09 20:31 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Rafael J. Wysocki, Len Brown, Jiang Liu, Thomas Gleixner,
linux-acpi, linux-kernel
On Mon, Dec 2, 2024 at 11:06 AM Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> wrote:
>
> In acpi_decode_space() addr->info.mem.caching is checked on main level
> for any resource type but addr->info.mem is part of union and thus
> valid only if the resource type is memory range.
>
> Move the check inside the preceeding switch/case to only execute it
> when the union is of correct type.
>
> Fixes: fcb29bbcd540 ("ACPI: Add prefetch decoding to the address space parser")
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
>
> I only came across this while reading code around these parts (not
> because of investigating some issue).
>
> drivers/acpi/resource.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> index 7fe842dae1ec..821867de43be 100644
> --- a/drivers/acpi/resource.c
> +++ b/drivers/acpi/resource.c
> @@ -250,6 +250,9 @@ static bool acpi_decode_space(struct resource_win *win,
> switch (addr->resource_type) {
> case ACPI_MEMORY_RANGE:
> acpi_dev_memresource_flags(res, len, wp);
> +
> + if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
> + res->flags |= IORESOURCE_PREFETCH;
> break;
> case ACPI_IO_RANGE:
> acpi_dev_ioresource_flags(res, len, iodec,
> @@ -265,9 +268,6 @@ static bool acpi_decode_space(struct resource_win *win,
> if (addr->producer_consumer == ACPI_PRODUCER)
> res->flags |= IORESOURCE_WINDOW;
>
> - if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
> - res->flags |= IORESOURCE_PREFETCH;
> -
> return !(res->flags & IORESOURCE_DISABLED);
> }
>
> --
Applied as 6.13-rc material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-09 20:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-02 10:06 [PATCH 1/1] ACPI: resource: Fix memory resource type union access Ilpo Järvinen
2024-12-09 20:31 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®