Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The fallback path for missing PAT tables does not abort execution, resulting in an uninitialized `xe->pat.ops` pointer being dereferenced.
--
--- Patch [9]: [PATCH 09/12] drm/xe/pat: Report missing PAT table using structured xe_log API ---
commit 08576418698c3b8696a3e32ba77fd4f46243b78e
Author: Dnyaneshwar Bhadane <[email protected]>
drm/xe/pat: Report missing PAT table using structured xe_log API
Replace drm_err() with xe_log_err() using the PAT component tag
when a platform has no matching PAT table entry.
> diff --git a/drivers/gpu/drm/xe/xe_pat.c b/drivers/gpu/drm/xe/xe_pat.c
> index 4331ef097ba0c..66a2d76ea00b5 100644
> --- a/drivers/gpu/drm/xe/xe_pat.c
> +++ b/drivers/gpu/drm/xe/xe_pat.c
[ ... ]
> @@ -686,8 +687,9 @@ void xe_pat_init_early(struct xe_device *xe)
> * raise an error rather than trying to silently inherit the
> * most recent platform's behavior.
> */
> - drm_err(&xe->drm, "Missing PAT table for platform with graphics version %d.%02d!\n",
> - GRAPHICS_VER(xe), GRAPHICS_VERx100(xe) % 100);
> + xe_log_err(xe, PAT, -EINVAL,
> + "Missing PAT table for platform with graphics version %d.%02d!\n",
> + GRAPHICS_VER(xe), GRAPHICS_VERx100(xe) % 100);
> }
>
> xe_assert(xe, xe->pat.ops);
[Severity: High]
This is a pre-existing issue, but since you are modifying this error path,
I wanted to ask about the missing early return here.
When a platform doesn't match any known PAT table (such as when force-probing
a new unconfigured PCI ID), xe_pat_init_early() logs an error but continues
execution. This leaves xe->pat.ops uninitialized.
In debug builds, this will immediately crash on the subsequent assertion:
xe_assert(xe, xe->pat.ops->dump);
In non-debug builds, it propagates to xe_pat_init() where it unconditionally
dereferences the uninitialized pointer:
if (xe_gt_is_media_type(gt))
xe->pat.ops->program_media(gt, xe->pat.table, xe->pat.n_entries);
else
xe->pat.ops->program_graphics(gt, xe->pat.table, xe->pat.n_entries);
Should this error path abort initialization rather than continuing with an
uninitialized xe->pat.ops pointer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.