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 wrong weight index in NPU_SET_SCALE1_LENGTH on U85
Date: Mon, 25 May 2026 17:19:40 +1000	[thread overview]
Message-ID: <review-patch2-20260523210840.92039-3-meatuni001@gmail.com> (raw)
In-Reply-To: <20260523210840.92039-3-meatuni001@gmail.com>

Patch Review

**Verdict: Correct, obvious typo/copy-paste fix.**

The change at line 601 (pre-patch):
```c
case NPU_SET_SCALE1_LENGTH: // NPU_SET_WEIGHT2_LENGTH (U85)
    if (ethosu_is_u65(edev))
        st.scale[1].length = cmds[1];
    else
        st.weight[1].length = cmds[1];  // BUG: should be weight[2]
```

Fixed to:
```c
    else
        st.weight[2].length = cmds[1];
```

This is unambiguously correct. The opcode `0x4093` is `NPU_SET_WEIGHT2_LENGTH` on non-U65 hardware (confirmed in `ethosu_device.h:148`). The BASE handler for the same opcode at line 591-596 correctly writes to `st.weight[2].base`, so the LENGTH handler must match with `st.weight[2].length`. The original code wrote to `weight[1]`, which is handled by the separate `NPU_SET_WEIGHT1_LENGTH` case at line 588-589 — so the bug both corrupted `weight[1].length` and left `weight[2].length` at its sentinel value of `0xffffffff`, breaking bounds checks for two weight buffers simultaneously.

The Fixes tag and Cc: stable are appropriate for both patches.

---
Generated by Claude Code Patch Reviewer

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23 21:07 [PATCH 0/2] accel/ethosu: fix two command stream parser bugs Muhammad Bilal
2026-05-23 21:07 ` [PATCH 1/2] accel/ethosu: reject NPU_OP_RESIZE commands from userspace Muhammad Bilal
2026-05-25  7:19   ` Claude review: " Claude Code Review Bot
2026-05-23 21:07 ` [PATCH 2/2] accel/ethosu: fix wrong weight index in NPU_SET_SCALE1_LENGTH on U85 Muhammad Bilal
2026-05-25  7:19   ` Claude Code Review Bot [this message]
2026-05-25  7:19 ` Claude review: accel/ethosu: fix two command stream parser bugs 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-patch2-20260523210840.92039-3-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