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: rust: drm: fix unsound initialization in drm::Device::new
Date: Tue, 05 May 2026 09:29:46 +1000	[thread overview]
Message-ID: <review-overall-20260501-fix-drm-1-v2-1-5c4f681837bc@nvidia.com> (raw)
In-Reply-To: <20260501-fix-drm-1-v2-1-5c4f681837bc@nvidia.com>

Overall Series Review

Subject: rust: drm: fix unsound initialization in drm::Device::new
Author: Eliot Courtney <ecourtney@nvidia.com>
Patches: 3
Reviewed: 2026-05-05T09:29:46.588748

---

This is a single-patch series fixing a real **soundness bug** in the Rust DRM device initialization path. The bug is: if `data.__pinned_init()` fails, the error path calls `drm_dev_put()`, which drops the refcount to zero, triggering `Self::release()`, which calls `drop_in_place()` on a `Device<T>` whose `data` field was never initialized — undefined behavior.

The fix is well-designed: use a temporary vtable with `release: None` during the initialization window, so that if init fails, `drm_dev_put()` skips the release callback and never drops uninitialized memory. After successful init, install the real vtable with the `const { &Self::VTABLE }` trick to guarantee a `'static` reference. The approach is sound and the implementation is correct.

**Recommendation: Accept.** One minor documentation nit below.

---

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-05-04 23:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01 10:49 [PATCH v2] rust: drm: fix unsound initialization in drm::Device::new Eliot Courtney
2026-05-03 11:49 ` Gary Guo
2026-05-03 12:21 ` Danilo Krummrich
2026-05-04 23:29 ` Claude Code Review Bot [this message]
2026-05-04 23:29 ` 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-overall-20260501-fix-drm-1-v2-1-5c4f681837bc@nvidia.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