diff options
author | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-08-18 22:24:25 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-11-05 11:43:18 +0100 |
commit | cf9cc49cd881139d56bdd7303ee897d8ff35b383 (patch) | |
tree | 1f259fcd34f4caab8d330f179a8f7deaf1a4246a /drivers/acpi | |
parent | 5880a0d1c83536e02502d014f24c186b127effdd (diff) |
ACPI: Add out of bounds and numa_off protections to pxm_to_node()
[ Upstream commit 8a3decac087aa897df5af04358c2089e52e70ac4 ]
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 <Jonathan.Cameron@huawei.com>
Reviewed-by: Barry Song <song.bao.hua@hisilicon.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/numa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index eadbf90e65d1..85e01752fbe4 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.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]; } |