Skip to content

Commit e3f5778

Browse files
ytcooderafaeljw
authored andcommitted
ACPI: NUMA: Fix the logic of getting the fake_pxm value
The for loop does not iterate over the last element of the node_to_pxm_map array. This could lead to a conflict between the final fake_pxm value and the existing pxm values. That is, the final fake_pxm value can not be guaranteed to be an unused pxm value. While at it, fix up white space in slit_valid(). Signed-off-by: Yuntao Wang <ytcoode@gmail.com> [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ec0f962 commit e3f5778

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/acpi/numa/srat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static int __init slit_valid(struct acpi_table_slit *slit)
183183
int i, j;
184184
int d = slit->locality_count;
185185
for (i = 0; i < d; i++) {
186-
for (j = 0; j < d; j++) {
186+
for (j = 0; j < d; j++) {
187187
u8 val = slit->entry[d*i + j];
188188
if (i == j) {
189189
if (val != LOCAL_DISTANCE)
@@ -532,7 +532,7 @@ int __init acpi_numa_init(void)
532532
*/
533533

534534
/* fake_pxm is the next unused PXM value after SRAT parsing */
535-
for (i = 0, fake_pxm = -1; i < MAX_NUMNODES - 1; i++) {
535+
for (i = 0, fake_pxm = -1; i < MAX_NUMNODES; i++) {
536536
if (node_to_pxm_map[i] > fake_pxm)
537537
fake_pxm = node_to_pxm_map[i];
538538
}

0 commit comments

Comments
 (0)