From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update
Date: Mon, 25 May 2026 19:32:33 +1000 [thread overview]
Message-ID: <review-patch1-20260521223756.627311-2-maaz.mombasawala@broadcom.com> (raw)
In-Reply-To: <20260521223756.627311-2-maaz.mombasawala@broadcom.com>
Patch Review
**Purpose:** Fix a null dereference when `old_state` is NULL in `vmw_cursor_plane_atomic_update`, found by IGT test `kms_cursor_legacy@torture-bo`.
**Issues:**
1. **Declaration-after-statement / mixed declarations and code (style):** The patch introduces variable declarations after statements, which violates the kernel coding style (and strict C89 rules still enforced by some kernel configs):
```c
new_state = drm_atomic_get_new_plane_state(state, plane);
if (!new_state)
return;
old_state = drm_atomic_get_old_plane_state(state, plane);
struct drm_crtc *crtc = new_state->crtc ? new_state->crtc :
(old_state ? old_state->crtc : NULL);
if (!crtc)
return;
struct vmw_private *dev_priv = vmw_priv(plane->dev);
```
The declarations of `crtc` and `dev_priv` appear after executable statements (the `if` guards). While C99/C11 allows this and the kernel has moved to C11, placing declarations like `struct drm_crtc *crtc` and `struct vmw_private *dev_priv` after `if` statements with `return` is unusual in kernel code. It would be cleaner to declare `crtc` at the top with `new_state`/`old_state` and assign it after the null checks.
2. **Double space:** Minor nit — there's a double space before `new_state->crtc`:
```c
struct drm_crtc *crtc = new_state->crtc ? new_state->crtc :
```
3. **Can `new_state` actually be NULL here?** In the atomic commit path, `drm_atomic_get_new_plane_state` should always return non-NULL for a plane that is in the commit. If the plane is not in the atomic state, it shouldn't be called at all. The commit message says this fixes `kms_cursor_legacy@torture-bo`, but it would be helpful to understand the exact call path that leads to `new_state` being NULL — this might indicate the real bug is elsewhere (the plane shouldn't be in an update callback if it's not part of the state).
4. **Missing Fixes tag specificity:** The Fixes tag references the refactor commit but no explanation is given as to why the prior code (which used the same `drm_atomic_get_old/new_plane_state` calls) didn't trigger this. A sentence about the calling context would help reviewers.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 9:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 22:37 [PATCH v4 0/4] Fix some issues from igt runs Maaz Mombasawala
2026-05-21 22:37 ` [PATCH v4 1/4] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-25 9:32 ` Claude Code Review Bot [this message]
2026-05-21 22:37 ` [PATCH v4 2/4] drm/vmwgfx: Check vrefresh in drm_mode_setcrtc Maaz Mombasawala
2026-05-25 9:32 ` Claude review: " Claude Code Review Bot
2026-05-21 22:37 ` [PATCH v4 3/4] drm/vmwgfx: Reserve ttm object before resv usage Maaz Mombasawala
2026-05-25 9:32 ` Claude review: " Claude Code Review Bot
2026-05-21 22:37 ` [PATCH v4 4/4] drm/vmwgfx: Change ttm refs for dumb buffers Maaz Mombasawala
2026-05-25 9:32 ` Claude review: " Claude Code Review Bot
2026-05-25 9:32 ` Claude review: Fix some issues from igt runs Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-14 22:48 [PATCH v3 0/5] " Maaz Mombasawala
2026-05-14 22:48 ` [PATCH v3 1/5] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-16 0:17 ` Claude review: " Claude Code Review Bot
2026-05-12 0:27 [PATCH v2 0/5] Fix some issues from igt runs Maaz Mombasawala
2026-05-12 0:27 ` [PATCH v2 1/5] drm/vmwgfx: Add some checks to vmw_cursor_plane_atomic_update Maaz Mombasawala
2026-05-16 4:26 ` Claude review: " Claude Code Review Bot
2026-03-20 1:49 [PATCH] " Maaz Mombasawala
2026-03-21 17:57 ` Claude review: " Claude Code Review Bot
2026-03-21 17:57 ` 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-20260521223756.627311-2-maaz.mombasawala@broadcom.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