aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-02-22 19:51:02 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-02-24 13:05:16 +0000
commit8c52c596d298ddaaa6e60bdbd17766e83dfe3edd (patch)
tree02938a1dc56187f1947861c6358d22f911cae3b7
parent6f45cf77e784d1bfc2a57119671937a3c064eac2 (diff)
downloadComputeLibrary-8c52c596d298ddaaa6e60bdbd17766e83dfe3edd.tar.gz
Check cpu index is within a valid range when populating cpu information
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I994fd72ed33d42b75d6ae6ef1fc5972faa3b4bf8 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5149 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/runtime/CPUUtils.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/CPUUtils.cpp b/src/runtime/CPUUtils.cpp
index 74f0f58248..6f51ee62ed 100644
--- a/src/runtime/CPUUtils.cpp
+++ b/src/runtime/CPUUtils.cpp
@@ -25,6 +25,7 @@
#include "arm_compute/core/CPP/CPPTypes.h"
#include "arm_compute/core/Error.h"
+#include "arm_compute/core/Log.h"
#include "support/StringSupport.h"
#include <algorithm>
@@ -290,10 +291,14 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
}
}
- if(curcpu >= 0)
+ if(curcpu >= 0 && curcpu < static_cast<int>(cpusv.size()))
{
cpusv[curcpu] = midr_to_model(midr);
}
+ else
+ {
+ ARM_COMPUTE_LOG_INFO_MSG_CORE("Trying to populate a core id with id greater than the expected number of cores!");
+ }
}
// Free allocated memory