Skip to content

Commit 7899ca9

Browse files
ij-intelrafaeljw
authored andcommitted
ACPI: resource: Fix memory resource type union access
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: fcb29bb ("ACPI: Add prefetch decoding to the address space parser") Signed-off-by: Ilpo Järvinen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent fac04ef commit 7899ca9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/acpi/resource.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ static bool acpi_decode_space(struct resource_win *win,
250250
switch (addr->resource_type) {
251251
case ACPI_MEMORY_RANGE:
252252
acpi_dev_memresource_flags(res, len, wp);
253+
254+
if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
255+
res->flags |= IORESOURCE_PREFETCH;
253256
break;
254257
case ACPI_IO_RANGE:
255258
acpi_dev_ioresource_flags(res, len, iodec,
@@ -265,9 +268,6 @@ static bool acpi_decode_space(struct resource_win *win,
265268
if (addr->producer_consumer == ACPI_PRODUCER)
266269
res->flags |= IORESOURCE_WINDOW;
267270

268-
if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
269-
res->flags |= IORESOURCE_PREFETCH;
270-
271271
return !(res->flags & IORESOURCE_DISABLED);
272272
}
273273

0 commit comments

Comments
 (0)