* [PATCH] drm/amdkfd: Fix missing check in kfd_parse_subtype_iolink
@ 2021-12-14 14:48 Miaoqian Lin
0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2021-12-14 14:48 UTC (permalink / raw)
Cc: linmq006, Felix Kuehling, Alex Deucher, Christian König,
Pan, Xinhui, David Airlie, Daniel Vetter, amd-gfx, dri-devel,
linux-kernel
The kmemdup() function may return NULL in case of error.
Add NULL checking to prevent potential null deference.
Signed-off-by: Miaoqian Lin <linmq006@gmail.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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-14 14:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 14:48 [PATCH] drm/amdkfd: Fix missing check in kfd_parse_subtype_iolink Miaoqian Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®