[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211214144823.16057-1-linmq006@gmail.com>
Date: Tue, 14 Dec 2021 14:48:23 +0000
From: Miaoqian Lin <linmq006@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linmq006@...il.com, Felix Kuehling <Felix.Kuehling@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm/amdkfd: Fix missing check in kfd_parse_subtype_iolink
The kmemdup() function may return NULL in case of error.
Add NULL checking to prevent potential null deference.
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
index cfedfb1e8596..59d55f752aa7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_crat.c
@@ -1060,6 +1060,8 @@ static int kfd_parse_subtype_iolink(struct crat_subtype_iolink *iolink,
return -ENODEV;
/* same everything but the other direction */
props2 = kmemdup(props, sizeof(*props2), GFP_KERNEL);
+ if (!props2)
+ return -ENOMEM;
props2->node_from = id_to;
props2->node_to = id_from;
props2->kobj = NULL;
--
2.17.1
Powered by blists - more mailing lists