Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] Missing endianness conversion for NPU command stream.
--

commit 0751ca432d602d192378042d9197a6392196efe4
Author: Rob Herring (Arm) <[email protected]>

accel: ethosu: Fix NHCWB16 bounds calculation

This commit fixes the NHCWB16 bounds calculation for the Ethos-U NPU driver.
It adjusts the address calculation to account for the NPU accessing data in
complete 16-channel bricks.

> diff --git a/drivers/accel/ethosu/ethosu_gem.c 
> b/drivers/accel/ethosu/ethosu_gem.c
> index 2707b7df5dbe6..6f6712f4efd1f 100644
> --- a/drivers/accel/ethosu/ethosu_gem.c
> +++ b/drivers/accel/ethosu/ethosu_gem.c

[ ... ]

While reviewing this file, I noticed a pre-existing issue in
ethosu_gem_cmdstream_copy_and_validate():

drivers/accel/ethosu/ethosu_gem.c:ethosu_gem_cmdstream_copy_and_validate()
...
                if (get_user(cmds[0], ucmds++))
                        return -EFAULT;

                bocmds[i] = cmds[0];

                cmd = cmds[0];
                param = cmds[0] >> 16;

                if (cmd & 0x4000) {
                        if (get_user(cmds[1], ucmds++))
                                return -EFAULT;

                        i++;
                        if (i >= size / 4)
                                return -EINVAL;
                        bocmds[i] = cmds[1];
...

[Severity: High]
This is a pre-existing issue, but should the NPU command stream be converted
for endianness here?

When reading from the user command stream on Big Endian hosts, the
Vela-compiled (Little Endian) commands will be read natively by get_user()
and copied directly to the DMA coherent buffer.

This causes the command opcode and parameter parsing to fail against the
expected command opcodes, returning -EINVAL.

This will cause the driver to reject valid jobs and render the driver
unusable on Big Endian architectures.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=10

Reply via email to