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/ras: Introduce the DRM RAS infrastructure over generic netlink Date: Tue, 03 Mar 2026 14:32:50 +1000 Message-ID: In-Reply-To: <20260228080858.3063532-8-riana.tauro@intel.com> References: <20260228080858.3063532-7-riana.tauro@intel.com> <20260228080858.3063532-8-riana.tauro@intel.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 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 ``` This header is for network devices and should not be needed for generic netlink RAS infrastructure. `` 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