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: media: pluto2: fix potential buffer overflow in pluto_dma_end()
Date: Wed, 25 Mar 2026 07:58:45 +1000	[thread overview]
Message-ID: <review-patch1-20260323102920.19937-1-Dmitry.Chumachenko@cyberprotect.ru> (raw)
In-Reply-To: <20260323102920.19937-1-Dmitry.Chumachenko@cyberprotect.ru>

Patch Review

**Assessment: Good fix, minor nit**

The bug is real. `TS_DMA_BYTES` is `188 * 8 = 1504`, and `dma_buf` is declared as `u8 dma_buf[TS_DMA_BYTES]` (line 111). The original loop:

```c
while (pluto->dma_buf[i] == 0x47)
    i += 188;
```

increments `i` by 188 each iteration. If every 188th byte happens to be `0x47`, `i` would reach `188 * 8 = 1504 = TS_DMA_BYTES`, and the next iteration would read `pluto->dma_buf[1504]` — one byte past the end of the buffer. The fix:

```c
while (i < TS_DMA_BYTES && pluto->dma_buf[i] == 0x47)
    i += 188;
```

correctly bounds-checks before accessing the buffer. Short-circuit evaluation ensures `dma_buf[i]` is never accessed when `i >= TS_DMA_BYTES`.

**Minor observation:** In practice, the maximum valid `i` after the loop would be `TS_DMA_BYTES` (1504), and `nbpackets = 1504 / 188 = 8 = TS_DMA_PACKETS`, which is the correct maximum. So the fix is semantically clean — it doesn't change behavior for valid data, only prevents the OOB read.

**Verdict:** Straightforward and correct one-line fix. The commit message, Fixes tag, and Signed-off-by are all proper.

Reviewed-by assessment: **Accept**.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-03-24 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23 10:29 [PATCH] media: pluto2: fix potential buffer overflow in pluto_dma_end() Dmitriy Chumachenko
2026-03-24 21:58 ` Claude Code Review Bot [this message]
2026-03-24 21:58 ` 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-20260323102920.19937-1-Dmitry.Chumachenko@cyberprotect.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