Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] drm/xe/guc: Fix inverted logic on snapshot->copy check
@ 2024-10-09 16:05 Colin Ian King
  2024-10-09 16:32 ` John Harrison
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Colin Ian King @ 2024-10-09 16:05 UTC (permalink / raw)
  To: Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter, Julia Filipchuk, John Harrison, intel-xe,
	dri-devel
  Cc: kernel-janitors, linux-kernel

Currently the check to see if snapshot->copy has been allocated is
inverted and ends up dereferencing snapshot->copy when free'ing
objects in the array when it is null or not free'ing the objects
when snapshot->copy is allocated. Fix this by using the correct
non-null pointer check logic.

Fixes: d8ce1a977226 ("drm/xe/guc: Use a two stage dump for GuC logs and add more info")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/gpu/drm/xe/xe_guc_log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c
index 93921f04153f..cc70f448d879 100644
--- a/drivers/gpu/drm/xe/xe_guc_log.c
+++ b/drivers/gpu/drm/xe/xe_guc_log.c
@@ -122,7 +122,7 @@ void xe_guc_log_snapshot_free(struct xe_guc_log_snapshot *snapshot)
 	if (!snapshot)
 		return;
 
-	if (!snapshot->copy) {
+	if (snapshot->copy) {
 		for (i = 0; i < snapshot->num_chunks; i++)
 			kfree(snapshot->copy[i]);
 		kfree(snapshot->copy);
-- 
2.39.5


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

end of thread, other threads:[~2024-10-10 12:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 16:05 [PATCH][next] drm/xe/guc: Fix inverted logic on snapshot->copy check Colin Ian King
2024-10-09 16:32 ` John Harrison
2024-10-10 12:57   ` Thomas Hellström
2024-10-09 17:14 ` ✓ CI.Patch_applied: success for " Patchwork
2024-10-09 17:14 ` ✓ CI.checkpatch: " Patchwork
2024-10-09 17:17 ` ✓ CI.KUnit: " Patchwork
2024-10-09 17:29 ` ✓ CI.Build: " Patchwork
2024-10-09 17:32 ` ✓ CI.Hooks: " Patchwork
2024-10-09 17:33 ` ✓ CI.checksparse: " Patchwork
2024-10-09 18:02 ` ✗ CI.BAT: failure " Patchwork
2024-10-10  4:57 ` ✗ CI.FULL: " Patchwork

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