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: reject NPU_OP_RESIZE commands from userspace
Date: Mon, 25 May 2026 17:19:40 +1000	[thread overview]
Message-ID: <review-patch1-20260523210840.92039-2-meatuni001@gmail.com> (raw)
In-Reply-To: <20260523210840.92039-2-meatuni001@gmail.com>

Patch Review

**Verdict: Correct fix, one minor style observation.**

The change replaces:
```c
case NPU_OP_RESIZE: // U85 only
    WARN_ON(1); // TODO
    break;
```
with:
```c
case NPU_OP_RESIZE: // U85 only
    return -EINVAL;
```

This is the right approach. The `WARN_ON(1)` was unconditionally user-triggerable from unprivileged userspace via `DRM_IOCTL_ETHOSU_GEM_CREATE`, making it a DoS vector (kernel log spam, or panic if `panic_on_warn` is set). Returning `-EINVAL` properly rejects the command at the ioctl level.

**Minor observation:** The `default:` case at line 650 silently ignores unknown opcodes (`break` with no error). This means `NPU_OP_RESIZE` is now treated *more strictly* than completely unknown/garbage opcodes — it returns an error, while unknown commands are silently accepted and passed through. This is arguably the right behavior for a known-but-unimplemented opcode, but the maintainer may want to consider whether `default:` should also return `-EINVAL` in a follow-up, since silently ignoring unrecognized commands seems fragile for a security-sensitive parser.

**No issues with fall-through:** The `return -EINVAL` exits the function entirely, so the absence of `break` before `case NPU_SET_KERNEL_WIDTH_M1:` is correct — there's no fall-through path.

---
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 Code Review Bot [this message]
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 review: " Claude Code Review Bot
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-patch1-20260523210840.92039-2-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