SWDEV-497288 - Fix Segfault when kernel param is nullptr

1) for case where kernelParam_.func = nullptr, the validation
fails in setParam call and memory is not alloced for kernelParams
2) destructor path segfaults trying to free the kernelParams memory.
3) copy of params is done after function validation is successful.

Change-Id: I6338e0c89f259632e4115f0508e2f240bc207fd9
이 커밋은 다음에 포함됨:
Rahul Manocha 작성하고 Rahul Manocha가 2024-11-26 11:34:41 -05:00를 커밋함
1 부모 e0c11624e5
커밋 1ac9286b5a
1 파일이 변경됨
+3 -1
+3 -1
파일 보기
@@ -1129,6 +1129,9 @@ class GraphKernelNode : public GraphNode {
const amd::KernelSignature& signature = kernel->signature();
numParams_ = signature.numParameters();
// Copy gridDim, blockDim, sharedMemBytes and func
kernelParams_ = *pNodeParams;
// Allocate/assign memory if params are passed part of 'kernelParams'
if (pNodeParams->kernelParams != nullptr) {
kernelParams_.kernelParams = (void**)malloc(numParams_ * sizeof(void*));
@@ -1303,7 +1306,6 @@ class GraphKernelNode : public GraphNode {
return status;
}
freeParams();
kernelParams_ = *params;
status = copyParams(params);
if (status != hipSuccess) {
ClPrint(amd::LOG_ERROR, amd::LOG_CODE, "[hipGraph] Failed to set params");