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/i915/gt: Use IS_ERR() check for kernel_context() in selftests
Date: Sat, 16 May 2026 10:29:02 +1000	[thread overview]
Message-ID: <review-overall-20260514193227.2472962-1-ingyujang25@korea.ac.kr> (raw)
In-Reply-To: <20260514193227.2472962-1-ingyujang25@korea.ac.kr>

Overall Series Review

Subject: drm/i915/gt: Use IS_ERR() check for kernel_context() in selftests
Author: Ingyu Jang <ingyujang25@korea.ac.kr>
Patches: 1
Reviewed: 2026-05-16T10:29:02.406576

---

**Verdict: Correct fix, but incomplete — misses one call site in the same file.**

The patch correctly identifies a real bug: `kernel_context()` (defined in `gem/selftests/mock_context.c`) returns `ERR_PTR` on failure (via `ERR_CAST` from `proto_context_create()` or directly from `i915_gem_create_context()`), never `NULL`. The existing `!ctx` checks would silently pass an `ERR_PTR` through, leading to a kernel oops on the very next dereference (e.g., `ctx_hi->sched.priority = ...`).

The transformation is mechanically correct in all four locations touched. However, the patch misses one more instance of the same bug in the same file at line 3685-3687 in `live_preempt_smoke()`:

```c
smoke.contexts[n] = kernel_context(smoke.gt->i915, NULL);
if (!smoke.contexts[n])
    goto err_ctx;
```

This should also be converted to `IS_ERR()` / `PTR_ERR()` for completeness, and `err_ctx` cleanup would need to handle passing an `ERR_PTR` in the `smoke.contexts[]` array (the cleanup loop calls `kernel_context_close()` on each non-NULL entry, so an `ERR_PTR` value would also be dereferenced there).

There may also be similar incorrect NULL checks in other selftest files (e.g., `selftest_hangcheck.c`, `selftest_workarounds.c`, `selftest_lrc.c`, etc.) that call `kernel_context()`. A v2 with broader scope would be more useful.

---

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-16  0:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 19:32 [PATCH] drm/i915/gt: Use IS_ERR() check for kernel_context() in selftests Ingyu Jang
2026-05-16  0:29 ` Claude review: " Claude Code Review Bot
2026-05-16  0:29 ` Claude Code Review Bot [this message]

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-overall-20260514193227.2472962-1-ingyujang25@korea.ac.kr \
    --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