All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: fix the system memory page fault because of copy overflow
@ 2021-01-15 18:46 Huang Rui
  2021-01-15 10:49 ` Su, Jinzhou (Joe)
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Huang Rui @ 2021-01-15 18:46 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Jinzhou Su, Huang Rui, Lee Jones, changfeng.zhu

The buffer is allocated with the size of pointer and copy with the size of
data structure. Then trigger the system memory page fault. Use the
orignal data structure to get the object size.

Fixes: a8e30005b drm/amd/display/dc/core/dc_link: Move some local data
from the stack to the heap

Signed-off-by: Huang Rui <ray.huang@amd.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index 69573d67056d..73178978ae74 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -1380,7 +1380,7 @@ static bool dc_link_construct(struct dc_link *link,
 
 	DC_LOGGER_INIT(dc_ctx->logger);
 
-	info = kzalloc(sizeof(info), GFP_KERNEL);
+	info = kzalloc(sizeof(struct integrated_info), GFP_KERNEL);
 	if (!info)
 		goto create_fail;
 
@@ -1545,7 +1545,7 @@ static bool dc_link_construct(struct dc_link *link,
 	}
 
 	if (bios->integrated_info)
-		memcpy(info, bios->integrated_info, sizeof(*info));
+		memcpy(info, bios->integrated_info, sizeof(struct integrated_info));
 
 	/* Look for channel mapping corresponding to connector and device tag */
 	for (i = 0; i < MAX_NUMBER_OF_EXT_DISPLAY_PATH; i++) {
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-15 15:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-15 18:46 [PATCH] drm/amd/display: fix the system memory page fault because of copy overflow Huang Rui
2021-01-15 10:49 ` Su, Jinzhou (Joe)
2021-01-15 11:21 ` Lee Jones
2021-01-15 11:22 ` Christian König
2021-01-15 13:44   ` Lee Jones
2021-01-15 21:35   ` Huang Rui
2021-01-15 11:26 ` Chen, Jiansong (Simon)
2021-01-15 21:38   ` Huang Rui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.