Add fix to check for vector size while reading pp_dpm_pcie

pop_back() was causing a seg fault when pp_dpm_pcie file is empty and returns whitespace.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I888f1f79751cd456e43751a5b96d08560a039677


[ROCm/amdsmi commit: ec71380e1c]
このコミットが含まれているのは:
Divya Shikre
2022-01-25 19:50:57 -05:00
コミット b8360c38b8
+3 -2
ファイルの表示
@@ -630,7 +630,7 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
ret = RSMI_STATUS_NOT_SUPPORTED;
}
fs.close();
return ret;
}
@@ -742,7 +742,8 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type,
return 0;
}
// Remove any *trailing* empty (whitespace) lines
while (retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
while (retVec->size() != 0 &&
retVec->back().find_first_not_of(" \t\n\v\f\r") == std::string::npos) {
retVec->pop_back();
}
return 0;