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
Этот коммит содержится в:
1 родитель
e0c11624e5
Коммит
1ac9286b5a
1 file changed
+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");
|
||||
|
||||
Reference in new issue
Block a user