From d4fa2e8c80e59e73ba2df8d7552b13e4abcc6f4f Mon Sep 17 00:00:00 2001 From: Sarbojit Sarkar Date: Thu, 24 Sep 2020 01:57:20 -0400 Subject: [PATCH] SWDEV-253654 : Added invalid parameter checks Change-Id: I8a2ae1ee6898f111aac1c68663a653cca410daec --- hipamd/rocclr/hip_peer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hipamd/rocclr/hip_peer.cpp b/hipamd/rocclr/hip_peer.cpp index ded6843957..fe22803c33 100755 --- a/hipamd/rocclr/hip_peer.cpp +++ b/hipamd/rocclr/hip_peer.cpp @@ -97,6 +97,10 @@ hipError_t hipExtGetLinkTypeAndHopCount(int device1, int device2, uint32_t* linktype, uint32_t* hopcount) { HIP_INIT_API(hipExtGetLinkTypeAndHopCount, device1, device2, linktype, hopcount); + if (linktype == nullptr || hopcount == nullptr || + device1 == device2 || device1 < 0 || device2 < 0) { + HIP_RETURN(hipErrorInvalidValue); + } // Fill out the list of LinkAttributes std::vector link_attrs; link_attrs.push_back(std::make_pair(amd::Device::LinkAttribute::kLinkLinkType, 0));