[PPC] Avoid underflows in NUMA domains
On POWER8 systems with only one memory domain, the "ibm,associativity" number that corresponds to it is 0, unlike POWER9 systems with two or more domains, in which the minimum value is 1. In POWER8 case, subtracting 1 causes an underflow on the unsigned domain variable and a subsequent index out-of-bounds access. Reviewed by: jhibbits Tested by: bdragon, luporl
This commit is contained in:
parent
080e9496b8
commit
f2c7768cce
@ -487,7 +487,7 @@ ofw_numa_mem_regions(struct numa_mem_region *memp, int *memsz)
|
||||
MPASS(count == 1);
|
||||
OF_getencprop(phandle, "ibm,associativity",
|
||||
associativity, res);
|
||||
curmemp->mr_domain = associativity[3] - 1;
|
||||
curmemp->mr_domain = associativity[3];
|
||||
if (bootverbose)
|
||||
printf("%s %#jx-%#jx domain(%ju)\n",
|
||||
name, (uintmax_t)curmemp->mr_start,
|
||||
|
@ -403,7 +403,7 @@ ofw_pcibus_parse_associativity(device_t dev, int *domain)
|
||||
OF_getencprop(node, "ibm,associativity",
|
||||
associativity, res);
|
||||
|
||||
*domain = associativity[3] - 1;
|
||||
*domain = associativity[3];
|
||||
if (bootverbose)
|
||||
device_printf(dev, "domain(%d)\n", *domain);
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user