Skip to content

Commit 7be41fb

Browse files
Dan Carpenterrobherring
authored andcommitted
accel: ethosu: Fix shift overflow in cmd_to_addr()
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: 5a5e9c0 ("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>
1 parent 4612074 commit 7be41fb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/accel/ethosu/ethosu_gem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static void cmd_state_init(struct cmd_state *st)
154154

155155
static u64 cmd_to_addr(u32 *cmd)
156156
{
157-
return ((u64)((cmd[0] & 0xff0000) << 16)) | cmd[1];
157+
return (((u64)cmd[0] & 0xff0000) << 16) | cmd[1];
158158
}
159159

160160
static u64 dma_length(struct ethosu_validated_cmdstream_info *info,

0 commit comments

Comments
 (0)