dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cavitt <jonathan.cavitt@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
	jonathan.cavitt@intel.com, gustavo.sousa@intel.com
Subject: [PATCH] drm/xe/rtp: Check hwe before calling match_func
Date: Fri, 29 May 2026 05:34:12 +0800	[thread overview]
Message-ID: <20260528213412.3709399-1-jonathan.cavitt@intel.com> (raw)

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 <jonathan.cavitt@intel.com>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>
---
 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


             reply	other threads:[~2026-05-28 21:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 21:34 Jonathan Cavitt [this message]
2026-05-28 21:46 ` [PATCH] drm/xe/rtp: Check hwe before calling match_func Cavitt, Jonathan
2026-05-28 22:29 ` Gustavo Sousa
2026-05-29 14:03   ` Cavitt, Jonathan
2026-05-29 15:07     ` Gustavo Sousa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260528213412.3709399-1-jonathan.cavitt@intel.com \
    --to=jonathan.cavitt@intel.com \
    --cc=alex.zuo@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo.sousa@intel.com \
    --cc=saurabhg.gupta@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox