SWDEV-251091: Added null checks and empty file check in hip_module and hip_platform

Change-Id: Iad99f996dcf90ffb86f62e79bf4cbd53b35b7e3b
Este commit está contenido en:
Sourabh Betigeri
2020-10-13 01:19:47 -07:00
cometido por Sourabh Betigeri
padre 5fec831e1c
commit 3c4208aa7d
Se han modificado 4 ficheros con 23 adiciones y 4 borrados
+8
Ver fichero
@@ -702,6 +702,10 @@ void PlatformState::init()
hipError_t PlatformState::loadModule(hipModule_t *module, const char* fname, const void* image) {
amd::ScopedLock lock(lock_);
if(module == nullptr) {
return hipErrorInvalidValue;
}
hip::DynCO* dynCo = new hip::DynCO();
hipError_t hip_error = dynCo->loadCodeObject(fname, image);
if (hip_error != hipSuccess) {
@@ -763,6 +767,10 @@ hipError_t PlatformState::getDynGlobalVar(const char* hostVar, hipModule_t hmod,
hipDeviceptr_t* dev_ptr, size_t* size_ptr) {
amd::ScopedLock lock(lock_);
if(hostVar == nullptr || dev_ptr == nullptr || size_ptr == nullptr) {
return hipErrorInvalidValue;
}
auto it = dynCO_map_.find(hmod);
if (it == dynCO_map_.end()) {
DevLogPrintfError("Cannot find the module: 0x%x", hmod);