From c5e3f955bfa3179c7758e2244517e8091c594e1d Mon Sep 17 00:00:00 2001 From: agodavar Date: Tue, 29 Dec 2020 05:42:54 -0500 Subject: [PATCH] SWDEV-266089: hipStreamAddCallback argument validation Change-Id: I3e61006796e88b4e2ba029118c95f3499959257b --- hipamd/rocclr/hip_stream.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hipamd/rocclr/hip_stream.cpp b/hipamd/rocclr/hip_stream.cpp index 24312f018d..16a64dc2a9 100755 --- a/hipamd/rocclr/hip_stream.cpp +++ b/hipamd/rocclr/hip_stream.cpp @@ -346,7 +346,10 @@ hipError_t hipStreamQuery(hipStream_t stream) { hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback, void* userData, unsigned int flags) { HIP_INIT_API(hipStreamAddCallback, stream, callback, userData, flags); - + //flags - Reserved for future use, must be 0 + if (callback == nullptr || flags != 0) { + HIP_RETURN(hipErrorInvalidValue); + } amd::HostQueue* hostQueue = hip::getQueue(stream); amd::Command* command = hostQueue->getLastQueuedCommand(true); if (command == nullptr) {