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 <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 978ffac commit abfaf0e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)