]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
accel: ethosu: Fix shift overflow in cmd_to_addr()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 29 Oct 2025 05:30:11 +0000 (08:30 +0300)
committerRob Herring (Arm) <robh@kernel.org>
Wed, 18 Feb 2026 22:28:08 +0000 (16:28 -0600)
The "((cmd[0] & 0xff0000) << 16)" shift is zero.  This was intended
to be (((u64)cmd[0] & 0xff0000) << 16).  Move the cast to the correct
location.

Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aQGmY64tWcwOGFP4@stanley.mountain
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/accel/ethosu/ethosu_gem.c

index 473b5f5d7514404bb84139d35d9e33bcb7b554b1..7b073116314baa98fb3c832b3ce9954c5fdb2478 100644 (file)
@@ -154,7 +154,7 @@ static void cmd_state_init(struct cmd_state *st)
 
 static u64 cmd_to_addr(u32 *cmd)
 {
-       return ((u64)((cmd[0] & 0xff0000) << 16)) | cmd[1];
+       return (((u64)cmd[0] & 0xff0000) << 16) | cmd[1];
 }
 
 static u64 dma_length(struct ethosu_validated_cmdstream_info *info,