diff options
author | Jonathan Cameron <[email protected]> | 2020-08-18 22:24:25 +0800 |
---|---|---|
committer | Rafael J. Wysocki <[email protected]> | 2020-09-24 12:57:37 +0200 |
commit | 8a3decac087aa897df5af04358c2089e52e70ac4 (patch) | |
tree | f6ee16ffb5c69459ffcb9589f403c18d44b3c1ff | |
parent | ba4f184e126b751d1bffad5897f263108befc780 (diff) |
ACPI: Add out of bounds and numa_off protections to pxm_to_node()
The function should check the validity of the pxm value before using
it to index the pxm_to_node_map[] array.
Whilst hardening this code may be good in general, the main intent
here is to enable following patches that use this function to replace
acpi_map_pxm_to_node() for non SRAT usecases which should return
NO_NUMA_NODE for PXM entries not matching with those in SRAT.
Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Barry Song <[email protected]>
Reviewed-by: Hanjun Guo <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
-rw-r--r-- | drivers/acpi/numa/srat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c index 15bbaab8500b..1fb486f46ee2 100644 --- a/drivers/acpi/numa/srat.c +++ b/drivers/acpi/numa/srat.c @@ -31,7 +31,7 @@ int acpi_numa __initdata; int pxm_to_node(int pxm) { - if (pxm < 0) + if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off) return NUMA_NO_NODE; return pxm_to_node_map[pxm]; } |