From: Colin Ian King Date: Wed, 9 Oct 2024 16:05:10 +0000 (+0100) Subject: drm/xe/guc: Fix inverted logic on snapshot->copy check X-Git-Tag: v6.13-rc1~122^2~17^2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46bcb0a1214ac6677df8660ac0f6bdf1eff27e8f;p=thirdparty%2Fkernel%2Flinux.git drm/xe/guc: Fix inverted logic on snapshot->copy check 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 Reviewed-by: John Harrison Signed-off-by: Thomas Hellström Link: https://patchwork.freedesktop.org/patch/msgid/20241009160510.372195-1-colin.i.king@gmail.com --- diff --git a/drivers/gpu/drm/xe/xe_guc_log.c b/drivers/gpu/drm/xe/xe_guc_log.c index 93921f04153f8..cc70f448d879c 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);