Null checks added for hipmallocpitch and hipmemcpy apis

Αυτή η υποβολή περιλαμβάνεται σε:
Lakhan Singh
2018-05-03 09:27:50 +05:30
γονέας beb41510ab
υποβολή 6411ca1f6d
+10 -1
Προβολή Αρχείου
@@ -339,6 +339,11 @@ hipError_t hipHostAlloc(void** ptr, size_t sizeBytes, unsigned int flags) {
// width in bytes
hipError_t ihipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height, size_t depth) {
hipError_t hip_status = hipSuccess;
if(ptr==NULL)
{
hip_status=hipErrorInvalidValue;
return hip_status;
}
// hardcoded 128 bytes
*pitch = ((((int)width - 1) / 128) + 1) * 128;
const size_t sizeBytes = (*pitch) * height;
@@ -1132,7 +1137,11 @@ hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind
hc::completion_future marker;
hipError_t e = hipSuccess;
if(dst==NULL || src==NULL)
{
e=hipErrorInvalidValue;
return e;
}
try {
stream->locked_copySync(dst, src, sizeBytes, kind);
} catch (ihipException& ex) {