libhsakmt: allow gpu nodeid arrary is null and number of gpu is zero.

Allow hsaKmtRegisterGraphicsHandleToNodes parameters NodeArray be null
and NumberOfNodes be zero at same time. It is the case we want the imported
buffer not be registered by kfd. Set gpu_id_array = NULL explicitly to avoid
free uninitialized gpuid array.

Report: Yat Sin, David<David.YatSin@amd.com>
Signed-off-by: Xiaogang Chen<Xiaogang.Chen@amd.com>
Change-Id: I3babc1160c9573e38dd11d81965c8de2b70cae2e
Este cometimento está contido em:
Xiaogang Chen criou e Xiaogang Chen cometeu 2023-05-29 00:15:14 -04:00
1 ascendente 7e4e57ae5f
cometimento f6183f937e
1 ficheiro modificado
+5 -3
+5 -3
Ver ficheiro
@@ -306,13 +306,15 @@ HSAKMT_STATUS HSAKMTAPI hsaKmtRegisterGraphicsHandleToNodes(HSAuint64 GraphicsRe
HSAuint32 *NodeArray)
{
CHECK_KFD_OPEN();
uint32_t *gpu_id_array;
uint32_t *gpu_id_array = NULL;
HSAKMT_STATUS ret = HSAKMT_STATUS_SUCCESS;
pr_debug("[%s] number of nodes %lu\n", __func__, NumberOfNodes);
ret = validate_nodeid_array(&gpu_id_array,
NumberOfNodes, NodeArray);
if (NodeArray != NULL || NumberOfNodes != 0) {
ret = validate_nodeid_array(&gpu_id_array,
NumberOfNodes, NodeArray);
}
if (ret == HSAKMT_STATUS_SUCCESS) {
ret = fmm_register_graphics_handle(