dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bilal Hashim" <AeeSec@126.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] accel/ethosu: validate strides, format, and overflow in feat_matrix_length()
Date: Sat, 28 Nov 2026 14:18:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-238764@kernel.org> (raw)
In-Reply-To: <20261128140630.1172-1-AeeSec@126.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] accel/ethosu: missing Fixes trailer for feat_matrix_length() fix
--

commit b15b9b8e0339b0188ac3731a239755db7038a2cd
Author: Bilal Hashim <AeeSec@126.com>

> accel/ethosu: validate strides, format, and overflow in feat_matrix_length()
>
> In ethosu_gem_cmdstream_copy_and_validate(), `cmd_state_init()` fills
> `struct cmd_state` with `0xff` so that missing setup commands can be
> detected (leaving `s64 stride_x`, `stride_y`, and `stride_c` equal to
> `-1`).
>
> However, `feat_matrix_length()` never checks whether `fm->stride_y`,
> `fm->stride_x`, or `fm->stride_c` are negative (uninitialized), does not
> reject invalid format values `(fm->precision >> 6) & 0x3` greater than 1,
> and performs unchecked arithmetic on `addr` and `addr + 1`. If a command
> stream omits a stride setup command, multiplying by `-1` shrinks `addr`
> below `fm->base[tile]`, underestimating `info->region_size[fm->region]`
> and weakening the BO bounds check in `ethosu_ioctl_submit_job()`.
>
> Reject negative strides and unknown formats, and use `check_mul_overflow`
> and `check_add_overflow` when computing `addr` and `end = addr + 1`.
>
> Signed-off-by: Bilal Hashim <AeeSec@126.com>

[Severity: Low]
This fixes a bug in command stream validation introduced with the driver.
Should this include:

  Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128140630.1172-1-AeeSec@126.com?part=1

      reply	other threads:[~2026-11-28 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 14:06 [PATCH] accel/ethosu: validate strides, format, and overflow in feat_matrix_length() Bilal Hashim
2026-11-28 14:18 ` sashiko-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=sashiko-outbox-238764@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=AeeSec@126.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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