public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/sched: fix NULL deref when logging missing entity runqueue
Date: Thu, 04 Jun 2026 11:58:59 +1000	[thread overview]
Message-ID: <review-patch1-20260603025636.1301481-1-candice.li@amd.com> (raw)
In-Reply-To: <20260603025636.1301481-1-candice.li@amd.com>

Patch Review

**Bug analysis — correct:**

The commit message accurately describes the problem. In `drm_sched_job_init()`, when `entity->rq` is NULL (line 591), the code immediately tries:

```c
dev_err(job->sched->dev, "%s: entity has no rq!\n", __func__);
```

At this point `job->sched` has not been set — `job->sched` is assigned only in `drm_sched_job_arm()` (line 653). Since the function hasn't even reached the `memset(job, 0, sizeof(*job))` on line 611 yet, `job->sched` is whatever was in the caller's memory, making this a NULL or wild-pointer dereference.

**Fix — correct but has a style nit:**

```c
pr_err("*ERROR* %s: entity has no rq!\n", __func__);
```

Switching from `dev_err()` to `pr_err()` is the right approach since there's no valid device pointer available at this point.

**Nit:** The `*ERROR*` prefix is inconsistent with kernel logging conventions. `pr_err()` already logs at error level and the kernel adds the appropriate severity marker. The existing `*ERROR*` prefix on the credits check at line 601 is pre-existing code, but propagating the pattern isn't ideal. A simple `pr_err("%s: entity has no rq!\n", __func__)` or `pr_err("drm_sched: entity has no rq!\n")` would be cleaner. That said, matching the existing pattern on line 601 is defensible for consistency within this function.

**Missing Fixes tag:** Given this is a real NULL-deref crash fix, the patch should carry a `Fixes:` tag pointing to the commit that introduced the `dev_err()` call with `job->sched->dev`. This helps stable-kernel backport processes.

**Overall:** The fix is correct, minimal, and addresses a real crash. Recommend adding the `Fixes:` tag and optionally dropping the `*ERROR*` prefix.

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-06-04  1:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  2:56 [PATCH] drm/sched: fix NULL deref when logging missing entity runqueue Candice Li
2026-06-03  5:58 ` Tvrtko Ursulin
2026-06-03  7:00 ` Christian König
2026-06-03  7:06   ` Philipp Stanner
2026-06-03  7:10     ` Philipp Stanner
2026-06-04  1:58 ` Claude Code Review Bot [this message]
2026-06-04  1:58 ` Claude review: " Claude Code Review Bot

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=review-patch1-20260603025636.1301481-1-candice.li@amd.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.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