Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpu/drm/xe/xe_devcoredump: Check NULL before dereferencing coredump.
@ 2024-03-20  5:17 Himal Prasad Ghimiray
  2024-03-20  5:08 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Himal Prasad Ghimiray @ 2024-03-20  5:17 UTC (permalink / raw)
  To: intel-xe; +Cc: Himal Prasad Ghimiray, Rodrigo Vivi

Derefernce coredump to get xe_devcoredump_snapshot only if coredump is
not NULL.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
---
 drivers/gpu/drm/xe/xe_devcoredump.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_devcoredump.c b/drivers/gpu/drm/xe/xe_devcoredump.c
index 0fcd30680323..83a1f3cd37cf 100644
--- a/drivers/gpu/drm/xe/xe_devcoredump.c
+++ b/drivers/gpu/drm/xe/xe_devcoredump.c
@@ -74,17 +74,20 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
 				   size_t count, void *data, size_t datalen)
 {
 	struct xe_devcoredump *coredump = data;
+	if (!coredump)
+		return -ENODATA;
+
 	struct xe_device *xe = coredump_to_xe(coredump);
+	/* Our device is gone already... */
+	if (!xe)
+		return -ENODEV;
+
 	struct xe_devcoredump_snapshot *ss = &coredump->snapshot;
 	struct drm_printer p;
 	struct drm_print_iterator iter;
 	struct timespec64 ts;
 	int i;
 
-	/* Our device is gone already... */
-	if (!data || !coredump_to_xe(coredump))
-		return -ENODEV;
-
 	/* Ensure delayed work is captured before continuing */
 	flush_work(&ss->work);
 
-- 
2.25.1


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

end of thread, other threads:[~2024-03-21 19:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20  5:17 [PATCH] gpu/drm/xe/xe_devcoredump: Check NULL before dereferencing coredump Himal Prasad Ghimiray
2024-03-20  5:08 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-20  5:09 ` ✓ CI.checkpatch: " Patchwork
2024-03-20  5:09 ` [PATCH] " Dixit, Ashutosh
2024-03-20  5:24   ` Ghimiray, Himal Prasad
2024-03-21 19:45     ` Rodrigo Vivi
2024-03-20  5:09 ` ✓ CI.KUnit: success for " Patchwork
2024-03-20  5:20 ` ✓ CI.Build: " Patchwork
2024-03-20  5:24 ` ✓ CI.Hooks: " Patchwork
2024-03-20  5:25 ` ✓ CI.checksparse: " Patchwork
2024-03-20  5:46 ` ✓ CI.BAT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox