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/ras: Introduce the DRM RAS infrastructure over generic netlink
Date: Tue, 03 Mar 2026 14:32:50 +1000	[thread overview]
Message-ID: <review-patch1-20260228080858.3063532-8-riana.tauro@intel.com> (raw)
In-Reply-To: <20260228080858.3063532-8-riana.tauro@intel.com>

Patch Review

**Memory leak in `doit_reply_value()`:**
When `get_node_error_counter()` fails, `msg` (allocated by `genlmsg_new`) is leaked:

```c
+	ret = get_node_error_counter(node_id, error_id,
+				     &error_name, &value);
+	if (ret)
+		return ret;   /* msg leaked here */
```

This needs `nlmsg_free(msg)` before the return.

**Uninitialized `ret` in `drm_ras_nl_list_nodes_dumpit()`:**
`ret` is declared but never initialized. If `drm_ras_xa` is empty, `xa_for_each_start` never executes the loop body, and `ret` is used uninitialized:

```c
+	int ret;
+	...
+	xa_for_each_start(&drm_ras_xa, id, node, ctx->restart) {
+		...
+	}
+
+	if (ret == -EMSGSIZE)   /* UB: ret uninitialized if xarray empty */
```

Initialize `ret = 0`.

**Same issue in `drm_ras_nl_get_error_counter_dumpit()`:**
If all error IDs in the range return `-ENOENT` (skipped via `continue`), then at the end of the loop `ret` is `-ENOENT`. The function will return `-ENOENT` to userspace instead of `0` (dump complete). The `ret` variable also needs to be initialized to `0` and the skip logic needs to reset `ret`.

**No concurrency protection on xarray access:**
`xa_load()` in the netlink handlers returns a pointer that can be invalidated by a concurrent `drm_ras_node_unregister()`. The `query_error_counter` callback could then be called on freed memory. At minimum, RCU read-side protection should be used around the lookup + callback invocation, and `xa_erase` should be followed by `synchronize_rcu()` or the node should be RCU-freed.

**Unnecessary include:**
```c
+#include <linux/netdevice.h>
```
This header is for network devices and should not be needed for generic netlink RAS infrastructure. `<net/genetlink.h>` should suffice.

**`drm_core_init` error path:**
```c
+	ret = drm_ras_genl_family_register();
+	if (ret < 0)
+		goto error;
```
The `goto error` doesn't unwind `drm_privacy_screen_lookup_init()` called just above. Check whether the existing `error` label handles this correctly; if not, a new cleanup label is needed.

---

---
Generated by Claude Code Patch Reviewer

  parent reply	other threads:[~2026-03-03  4:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  8:08 [PATCH v9 0/5] Introduce DRM_RAS using generic netlink for RAS Riana Tauro
2026-02-28  8:08 ` [PATCH v9 1/5] drm/ras: Introduce the DRM RAS infrastructure over generic netlink Riana Tauro
2026-02-28 16:04   ` Jakub Kicinski
2026-03-03  4:32   ` Claude Code Review Bot [this message]
2026-02-28  8:08 ` [PATCH v9 2/5] drm/xe/xe_drm_ras: Add support for XE DRM RAS Riana Tauro
2026-03-03  4:32   ` Claude review: " Claude Code Review Bot
2026-02-28  8:08 ` [PATCH v9 3/5] drm/xe/xe_hw_error: Integrate DRM RAS with hardware error handling Riana Tauro
2026-03-03  4:32   ` Claude review: " Claude Code Review Bot
2026-02-28  8:08 ` [PATCH v9 4/5] drm/xe/xe_hw_error: Add support for Core-Compute errors Riana Tauro
2026-03-03  4:32   ` Claude review: " Claude Code Review Bot
2026-02-28  8:08 ` [PATCH v9 5/5] drm/xe/xe_hw_error: Add support for PVC SoC errors Riana Tauro
2026-03-03  4:32   ` Claude review: " Claude Code Review Bot
2026-03-03  4:32 ` Claude review: Introduce DRM_RAS using generic netlink for RAS Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-03-04  7:44 [PATCH v10 0/5] " Riana Tauro
2026-03-04  7:44 ` [PATCH v10 1/5] drm/ras: Introduce the DRM RAS infrastructure over generic netlink Riana Tauro
2026-03-05  3:47   ` Claude review: " Claude Code Review Bot
2026-02-23  6:05 [PATCH v8 0/5] Introduce DRM_RAS using generic netlink for RAS Riana Tauro
2026-02-23  6:05 ` [PATCH v8 1/5] drm/ras: Introduce the DRM RAS infrastructure over generic netlink Riana Tauro
2026-02-24  0:45   ` 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-patch1-20260228080858.3063532-8-riana.tauro@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