From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/modeset_lock: add NULL check for ctx before WARN_ON
Date: Tue, 05 May 2026 11:50:04 +1000 [thread overview]
Message-ID: <review-patch1-20260429025952.1202080-1-george.d.sworo@intel.com> (raw)
In-Reply-To: <20260429025952.1202080-1-george.d.sworo@intel.com>
Patch Review
**NAK.**
The change:
```c
- if (WARN_ON(ctx->contended))
+ if (ctx && WARN_ON(ctx->contended))
```
**Problem 1: The guard is unnecessary.** As discussed above, `modeset_lock()` is a static helper only called from `drm_modeset_lock()` (which already NULL-checks `ctx` before calling it) and `drm_modeset_backoff()` (which dereferences `ctx` before calling it). There is no path where `ctx` is NULL here.
**Problem 2: The patch is incomplete even on its own terms.** It guards the `ctx->contended` dereference on line 298, but the very next line that uses `ctx` is:
```c
if (ctx->trylock_only) {
```
This dereference at line 301 is left completely unguarded. If `ctx` truly could be NULL, this patch would still crash two lines later. Patch 1 in isolation does not produce a correct result.
**Problem 3: Inaccurate commit message.** The commit message says "modeset_lock() and drm_modeset_drop_locks() do not validate the ctx pointer" but neither this patch nor patch 2 modifies `drm_modeset_drop_locks()`.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-05-05 1:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 2:59 [PATCH] drm/modeset_lock: add NULL check for ctx before WARN_ON george.d.sworo
2026-04-29 6:04 ` [PATCH v2 0/2] drm/i915/modeset: fix NULL/ctx handling in lock paths george.d.sworo
2026-04-29 6:04 ` [PATCH v2 1/2] drm/modeset_lock: add NULL check for ctx before WARN_ON george.d.sworo
2026-04-29 11:09 ` Ville Syrjälä
2026-04-30 4:12 ` Sworo, George D
2026-04-29 6:04 ` [PATCH v2 2/2] drm/modeset: harden modeset_lock() against NULL ctx george.d.sworo
2026-05-05 1:50 ` Claude review: " Claude Code Review Bot
2026-05-05 1:50 ` Claude review: drm/i915/modeset: fix NULL/ctx handling in lock paths Claude Code Review Bot
2026-05-05 1:50 ` 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-patch1-20260429025952.1202080-1-george.d.sworo@intel.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