Refactor handling CPUInfo array
It was found that sometimes peci-pcie crashes with out-of-range read of
cpuInfo vector. This happens on start scan when for some reasons system
failed to initialize vector.
While technically enough to add guard near the line
scanPCIeDevice(io, objServer, cpuInfo, 0, 0, 0);
it is better to refactor whole related code.
This commit introduces following code optimizations:
* Merge getClientAddrMap and getCPUBusNums to one function getCPUBusMap
since they both always called together and do same work: fill cpuInfo
vector. Resulting getCPUBusMap function now return error if no CPUs
discovered.
* probePCIeDevice doesn't really need cpuInfo vector, it's fine with
just single CPU address.
* scanPCIeDevice now the only function which read from cpuInfo and it
verify index before and return if it is not valid.
Tested: ensure no functional changes, no crash if cpuInfo vector empty
Signed-off-by: Andrei Kartashev <a.kartashev@yadro.com>
Change-Id: Ie6bab4e844670ceecd515728f43f7d22efa1aed6
1 file changed