-----Original Message----- From: Cavitt, Jonathan <[email protected]> Sent: Thursday, May 28, 2026 2:34 PM To: [email protected] Cc: Gupta, Saurabhg <[email protected]>; Zuo, Alex <[email protected]>; Cavitt, Jonathan <[email protected]>; Sousa, Gustavo <[email protected]> Subject: [PATCH] drm/xe/rtp: Check hwe before calling match_func > > XE_RTP_MATCH_FUNC may attempt to dereference the target xe_hw_engine. > Ensure the hwe is not NULL before calling the function, matching > XE_RTP_MATCH_ENGINE_CLASS, for example. > > This covers a static analysis issue. > > Signed-off-by: Jonathan Cavitt <[email protected]> > Cc: Gustavo Sousa <[email protected]> > --- > drivers/gpu/drm/xe/xe_rtp.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_rtp.c b/drivers/gpu/drm/xe/xe_rtp.c > index dec9d94e6fb0..2cd26db113d9 100644 > --- a/drivers/gpu/drm/xe/xe_rtp.c > +++ b/drivers/gpu/drm/xe/xe_rtp.c > @@ -129,6 +129,9 @@ static bool rule_match_item(struct rule_match_ctx > *match_ctx) > > return hwe->class != r->engine_class; > case XE_RTP_MATCH_FUNC: > + if (drm_WARN_ON(&xe->drm, !hwe)) > + return false; > + > return r->match_func(xe, gt, hwe);
I only just now noticed that this is also a possible issue with gt. I'll wait for a response from Gustavo Sousa before creating a new revision with the added gt check, as it's possible these checks aren't necessary. If they aren't necessary, I'll just mark these as false positives on my end. -Jonathan Cavitt > default: > drm_warn(&xe->drm, "Invalid RTP match %u\n", > -- > 2.53.0 > >
