Skip to content

Commit abfaf0e

Browse files
JiangJiasalexdeucher
authored andcommitted
drm/amdkfd: Check for null pointer after calling kmemdup
As the possible failure of the allocation, kmemdup() may return NULL pointer. Therefore, it should be better to check the 'props2' in order to prevent the dereference of NULL pointer. Fixes: 3a87177 ("drm/amdkfd: Add topology support for dGPUs") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 978ffac commit abfaf0e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_crat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,9 @@ static int kfd_parse_subtype_iolink(struct crat_subtype_iolink *iolink,
10601060
return -ENODEV;
10611061
/* same everything but the other direction */
10621062
props2 = kmemdup(props, sizeof(*props2), GFP_KERNEL);
1063+
if (!props2)
1064+
return -ENOMEM;
1065+
10631066
props2->node_from = id_to;
10641067
props2->node_to = id_from;
10651068
props2->kobj = NULL;

0 commit comments

Comments
 (0)