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/xe/ras: Get error threshold support
Date: Sat, 16 May 2026 12:54:50 +1000	[thread overview]
Message-ID: <review-patch5-20260512191610.1817578-6-raag.jadav@intel.com> (raw)
In-Reply-To: <20260512191610.1817578-6-raag.jadav@intel.com>

Patch Review

Implements `xe_ras_get_threshold()` which sends a mailbox command to the system controller.

**Issue: No bounds checking on `severity` and `component` parameters before array indexing.**

```c
int xe_ras_get_threshold(struct xe_device *xe, u32 severity, u32 component, u32 *threshold)
{
    ...
    counter.common.severity = drm_to_xe_ras_severities[severity];
    counter.common.component = drm_to_xe_ras_components[component];
```

The `severity` and `component` values come from the drm_ras callback, which passes `error_id` as the component. Although the drm_ras core does range-check `error_id` against `error_counter_range`, there is no explicit bounds check in `xe_ras_get_threshold()` itself against the array sizes of `drm_to_xe_ras_severities[]` and `drm_to_xe_ras_components[]`. Since the caller hard-codes `DRM_XE_RAS_ERR_SEV_CORRECTABLE` for severity, that's safe for now, but the function signature accepts arbitrary `u32` values, making it fragile for future use. At minimum, defensive checks or `BUILD_BUG_ON` assertions tying the array size to expected usage would be prudent.

**Minor: Unused `counter` assignment from response.**

```c
    counter = response.counter;
    *threshold = response.threshold;
```

The `counter` variable is reassigned from the response but only used in the debug print. This is fine for debugging but the local variable `counter` shadows the fact that it was previously the *request* counter — could be confusing. Consider using a separate variable name or just accessing `response.counter.common.*` directly in the debug print.

---

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-16  2:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 19:16 [PATCH v2 0/9] Introduce error threshold to drm_ras Raag Jadav
2026-05-12 19:16 ` [PATCH v2 1/9] drm/ras: Update counter helpers with counter naming Raag Jadav
2026-05-12 20:49   ` Rodrigo Vivi
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 2/9] drm/ras: Introduce get-error-threshold Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 3/9] drm/ras: Introduce set-error-threshold Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 4/9] drm/xe/uapi: Add additional error components to xe drm_ras Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 5/9] drm/xe/ras: Get error threshold support Raag Jadav
2026-05-16  2:54   ` Claude Code Review Bot [this message]
2026-05-12 19:16 ` [PATCH v2 6/9] drm/xe/ras: Set " Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 7/9] drm/xe/drm_ras: Wire up error threshold callbacks Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 8/9] drm/xe/xe_ras: Move xe drm_ras registration Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-12 19:16 ` [PATCH v2 9/9] drm/xe/xe_ras: Control xe drm_ras registration with a flag Raag Jadav
2026-05-16  2:54   ` Claude review: " Claude Code Review Bot
2026-05-16  2:54 ` Claude review: Introduce error threshold to drm_ras 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-patch5-20260512191610.1817578-6-raag.jadav@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