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: accel/ethosu: fix integer overflow in dma_length()
Date: Mon, 25 May 2026 17:08:44 +1000	[thread overview]
Message-ID: <review-patch1-20260524051659.70654-1-meatuni001@gmail.com> (raw)
In-Reply-To: <20260524051659.70654-1-meatuni001@gmail.com>

Patch Review

This is v1 and is **superseded by v3**. It only addresses multiplication overflow:

```c
-		len *= dma_st->size0;
+		if (check_mul_overflow(len, (u64)dma_st->size0, &len))
+			return U64_MAX;
```

**Issues in v1:**

1. **Missing negative stride underflow check.** Before the multiplication, `len += dma->stride[0]` adds a signed `s64` to an unsigned `u64`. If `stride[0]` is a large negative value (sign-extended from 40-bit input), this wraps `len` to a huge value. With `size0 == 1`, `check_mul_overflow` does not trigger, and the result is a garbage length.

2. **Missing caller validation.** The commit message claims "the callers of dma_length() already treat U64_MAX as an error sentinel," but looking at the caller at the original line 397–400 (now line 407), `srclen`/`dstlen` were only used in a `dev_dbg()` format string — the return value was never checked for `U64_MAX`. This means even when `dma_length()` returns `U64_MAX`, the `info->region_size[]` entry would remain at 0 (never updated because the function returned early), and the region would be skipped entirely by `ethosu_job.c` at line 420/670, allowing stale physical addresses through. This claim in the commit message is **incorrect** for the `NPU_OP_DMA_START` case.

3. **Missing `len + dma->offset` overflow check** at the `region_size` update.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-05-25  7:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24  5:16 [PATCH] accel/ethosu: fix integer overflow in dma_length() Muhammad Bilal
2026-05-24  6:06 ` [PATCH v2] accel/ethosu: fix integer overflow and underflow " Muhammad Bilal
2026-05-24 10:37   ` [PATCH v3] accel/ethosu: fix arithmetic issues " Muhammad Bilal
2026-05-25  7:08     ` Claude review: " Claude Code Review Bot
2026-05-25  7:08   ` Claude review: accel/ethosu: fix integer overflow and underflow " Claude Code Review Bot
2026-05-25  7:08 ` Claude review: accel/ethosu: fix integer overflow " Claude Code Review Bot
2026-05-25  7:08 ` 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-20260524051659.70654-1-meatuni001@gmail.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