drm/xe/guc: Fix dereference before NULL check
authorEverest K.C. <everestkc@everestkc.com.np>
Wed, 23 Oct 2024 23:33:55 +0000 (17:33 -0600)
committerJohn Harrison <John.C.Harrison@Intel.com>
Thu, 31 Oct 2024 21:25:00 +0000 (14:25 -0700)
commit2aff81e039de5b0b7ef6bdcb2c320f121f69e2b4
treec7582ecafb5f9d8848c5c42ab54d34cbd2c8e508
parent35d25a4a0012e690ef0cc4c5440231176db595cc
drm/xe/guc: Fix dereference before NULL check

The pointer list->list is dereferenced before the NULL check.
Fix this by moving the NULL check outside the for loop, so that
the check is performed before the dereferencing.
The list->list pointer cannot be NULL so this has no effect on runtime.
It's just a correctness issue.

This issue was reported by Coverity Scan.
https://scan7.scan.coverity.com/#/project-view/51525/11354?selectedIssue=1600335

Fixes: 0f1fdf559225 ("drm/xe/guc: Save manual engine capture into capture list")
Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241023233356.5479-1-everestkc@everestkc.com.np
drivers/gpu/drm/xe/xe_guc_capture.c