mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
ACPI: resource: Fix memory resource type union access
[ Upstream commit7899ca9f3b
] 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:fcb29bbcd5
("ACPI: Add prefetch decoding to the address space parser") Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://patch.msgid.link/20241202100614.20731-1-ilpo.jarvinen@linux.intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9f82e8ace7
commit
78079fda48
@ -250,6 +250,9 @@ static bool acpi_decode_space(struct resource_win *win,
|
|||||||
switch (addr->resource_type) {
|
switch (addr->resource_type) {
|
||||||
case ACPI_MEMORY_RANGE:
|
case ACPI_MEMORY_RANGE:
|
||||||
acpi_dev_memresource_flags(res, len, wp);
|
acpi_dev_memresource_flags(res, len, wp);
|
||||||
|
|
||||||
|
if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
|
||||||
|
res->flags |= IORESOURCE_PREFETCH;
|
||||||
break;
|
break;
|
||||||
case ACPI_IO_RANGE:
|
case ACPI_IO_RANGE:
|
||||||
acpi_dev_ioresource_flags(res, len, iodec,
|
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)
|
if (addr->producer_consumer == ACPI_PRODUCER)
|
||||||
res->flags |= IORESOURCE_WINDOW;
|
res->flags |= IORESOURCE_WINDOW;
|
||||||
|
|
||||||
if (addr->info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
|
|
||||||
res->flags |= IORESOURCE_PREFETCH;
|
|
||||||
|
|
||||||
return !(res->flags & IORESOURCE_DISABLED);
|
return !(res->flags & IORESOURCE_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user