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

Change-Id: Iad99f996dcf90ffb86f62e79bf4cbd53b35b7e3b


[ROCm/hip commit: 3c4208aa7d]
This commit is contained in:
Sourabh Betigeri
2020-10-13 01:19:47 -07:00
committato da Sourabh Betigeri
parent ff4c647424
commit f02cf67087
4 ha cambiato i file con 23 aggiunte e 4 eliminazioni
+8
Vedi File
@@ -84,6 +84,10 @@ extern hipError_t __hipExtractCodeObjectFromFatBinary(const void* data,
hipError_t hipModuleGetFunction(hipFunction_t *hfunc, hipModule_t hmod, const char *name) {
HIP_INIT_API(hipModuleGetFunction, hfunc, hmod, name);
if(hfunc == nullptr || name == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (hipSuccess != PlatformState::instance().getDynFunc(hfunc, hmod, name)) {
DevLogPrintfError("Cannot find the function: %s for module: 0x%x \n",
name, hmod);
@@ -97,6 +101,10 @@ hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t h
{
HIP_INIT_API(hipModuleGetGlobal, dptr, bytes, hmod, name);
if(dptr == nullptr || bytes == nullptr || name == nullptr) {
return hipErrorInvalidValue;
}
/* Get address and size for the global symbol */
if (hipSuccess != PlatformState::instance().getDynGlobalVar(name, hmod, dptr, bytes)) {
DevLogPrintfError("Cannot find global Var: %s for module: 0x%x at device: %d \n",