From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260514193227.2472962-1-ingyujang25@korea.ac.kr> References: <20260514193227.2472962-1-ingyujang25@korea.ac.kr> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Overall Series Review Subject: drm/i915/gt: Use IS_ERR() check for kernel_context() in selftests Author: Ingyu Jang Patches: 1 Reviewed: 2026-05-16T10:29:02.406576 --- **Verdict: Correct fix, but incomplete =E2=80=94 misses one call site in th= e 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., `ct= x_hi->sched.priority =3D ...`). The transformation is mechanically correct in all four locations touched. H= owever, 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] =3D 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 `sm= oke.contexts[]` array (the cleanup loop calls `kernel_context_close()` on e= ach 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 usef= ul. --- --- Generated by Claude Code Patch Reviewer