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

Change-Id: Iad99f996dcf90ffb86f62e79bf4cbd53b35b7e3b
Tá an tiomantas seo le fáil i:
Sourabh Betigeri
2020-10-13 01:19:47 -07:00
tiomanta ag Sourabh Betigeri
tuismitheoir 4e96bfecd5
tiomantas b65314d168
D'athraigh 4 comhad le 23 breiseanna agus 4 scriosta
+8
Féach ar an gComhad
@@ -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",