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:43 +1000 [thread overview]
Message-ID: <review-overall-20260524051659.70654-1-meatuni001@gmail.com> (raw)
In-Reply-To: <20260524051659.70654-1-meatuni001@gmail.com>
Overall Series Review
Subject: accel/ethosu: fix integer overflow in dma_length()
Author: Muhammad Bilal <meatuni001@gmail.com>
Patches: 3
Reviewed: 2026-05-25T17:08:43.686509
---
This mbox contains three versions (v1, v2, v3) of the same patch fixing arithmetic issues in `dma_length()` in the Arm Ethos-U NPU accelerator driver. Only v3 should be considered for merging — v1 and v2 are superseded.
The core issue is real and security-relevant: user-supplied command stream values feed into unchecked arithmetic that computes `region_size[]`, which is later used as a bounds check against GEM buffer sizes. Integer wraparound can underreport the true DMA region usage, allowing the NPU hardware to access memory outside the allocated GEM buffer.
The v3 patch correctly addresses four arithmetic hazards: negative stride underflow, multiplication overflow, `len + offset` overflow, and the missing caller validation of the `U64_MAX` error sentinel. The fix is well-scoped and uses the standard kernel overflow helpers (`check_mul_overflow`, `check_add_overflow`).
One observation for a possible follow-up: the same `addr + 1` addition at `ethosu_gem.c:240` in `feat_matrix_length()`, and the `base + length` additions at lines 291–293 and 303–305 in `calc_sizes()`, have no overflow protection either. These are analogous to the `len + offset` overflow that v3 fixed in `dma_length()`.
---
---
Generated by Claude Code Patch Reviewer
next prev 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 Code Review Bot [this message]
2026-05-25 7:08 ` Claude review: accel/ethosu: fix integer overflow " 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-overall-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