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/radeon: Fix OOB read in MC register table init
Date: Thu, 04 Jun 2026 16:32:17 +1000	[thread overview]
Message-ID: <review-patch1-20260529121436.1633842-1-n.zhandarovich@fintech.ru> (raw)
In-Reply-To: <20260529121436.1633842-1-n.zhandarovich@fintech.ru>

Patch Review

**Problem analysis:** In `radeon_atom_init_mc_reg_table()`, the inner `for` loop at line 4029 iterates `i` starting from 0. When `pre_reg_data` has `DATA_EQU_PREV` set for the first entry (`i == 0`), the code accesses `mc_data[i - 1]` which underflows to `mc_data[-1]` — a clear out-of-bounds read.

**Fix analysis:** The patch adds:
```c
if (i == 0)
    continue;
```
at line 4035-4036, before the `mc_data[i - 1]` access. This is correct:

1. **`continue` targets the right loop.** The innermost enclosing loop is the `for (i = 0, j = 1; i < reg_table->last; i++)` at line 4029. The `continue` skips the copy for entry 0 and advances `i`, which is the desired behavior — leaving `mc_data[0]` uninitialized for this case is acceptable since `DATA_EQU_PREV` on the first entry is a malformed table condition with no meaningful "previous" value to copy.

2. **Exact match to the amdgpu fix.** The amdgpu equivalent at `amdgpu_atombios.c:1525-1526` uses the identical pattern (`if (i == 0) continue;`), so this is consistent across both drivers.

3. **No side effects on `j`.** The `j` index is only incremented in the `DATA_FROM_TABLE` branch, not the `DATA_EQU_PREV` branch, so skipping via `continue` doesn't desynchronize the data pointer.

4. **Fixes tag and stable tag are appropriate.** The Fixes tag points to the original commit that introduced this code path (`ae5b0abbb6f7`), and the `Cc: stable` is warranted since this is a real OOB read.

**Minor note:** The commit message mentions "Emulate a fix" — the wording is slightly odd ("apply the same fix as" would be more natural), but this is cosmetic and not worth a respin.

**Reviewed-by worthy.** No issues found.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-06-04  6:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 12:14 [PATCH] drm/radeon: Fix OOB read in MC register table init Nikita Zhandarovich
2026-06-04  6:32 ` Claude Code Review Bot [this message]
2026-06-04  6:32 ` 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-20260529121436.1633842-1-n.zhandarovich@fintech.ru \
    --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