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); default: drm_warn(&xe->drm, "Invalid RTP match %u\n", -- 2.53.0
