From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: misc: fastrpc: fix DMA address corruption due to find_vma misuse
Date: Sat, 16 May 2026 09:24:08 +1000 [thread overview]
Message-ID: <review-patch1-SYBPR01MB78819393A1F4FA658B2AB076AF042@SYBPR01MB7881.ausprd01.prod.outlook.com> (raw)
In-Reply-To: <SYBPR01MB78819393A1F4FA658B2AB076AF042@SYBPR01MB7881.ausprd01.prod.outlook.com>
Patch Review
**Correctness: Good.** The core issue is well-identified. At line 1044 (post-patch):
```c
vma = vma_lookup(current->mm, ctx->args[i].ptr);
if (vma)
pages[i].addr += (ctx->args[i].ptr & PAGE_MASK) -
vma->vm_start;
```
With the old `find_vma()`, if `ctx->args[i].ptr` fell in a hole before the returned VMA, `(ctx->args[i].ptr & PAGE_MASK) - vma->vm_start` would produce a large unsigned underflow, corrupting `pages[i].addr`. With `vma_lookup()`, such cases correctly return NULL and the offset is not applied.
**One observation:** When `vma_lookup()` returns NULL (address not in any VMA), the code silently proceeds with `pages[i].addr` set to the raw `ctx->maps[i]->dma_addr` without any offset, and continues to compute `pages[i].size` based on the pointer. This means a bad user-supplied pointer won't cause an immediate error — it will send a potentially wrong DMA address to the DSP. The existing code had this same "silent fallthrough" behavior with `find_vma()` (just the `if (vma)` guard was already there), so this patch doesn't make it worse, but a follow-up that returns an error when `vma_lookup()` returns NULL would be a stronger fix. That said, it's out of scope for this minimal fix and the Fixes/Cc:stable tags are appropriate.
**Commit message: Good.** Clear explanation of the root cause (underflow in the offset calculation), the trigger (address in a gap before the VMA), and the fix (switch to `vma_lookup()`). The Fixes tag correctly references commit `80f3afd72bd4` which introduced the `find_vma()` usage.
**Tags: Correct.** Cc: stable, Fixes, Reported-by, and Signed-off-by are all present and properly formatted.
**No other issues found.** The patch is a clean one-line change with no side effects.
---
Generated by Claude Code Patch Reviewer
prev parent reply other threads:[~2026-05-15 23:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 9:16 [PATCH] misc: fastrpc: fix DMA address corruption due to find_vma misuse Junrui Luo
2026-05-15 23:24 ` Claude review: " Claude Code Review Bot
2026-05-15 23:24 ` Claude Code Review Bot [this message]
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-SYBPR01MB78819393A1F4FA658B2AB076AF042@SYBPR01MB7881.ausprd01.prod.outlook.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