public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] accel: ethosu: Fix shift overflow in cmd_to_addr()
@ 2025-10-29  5:30 Dan Carpenter
  2026-02-18 22:30 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-10-29  5:30 UTC (permalink / raw)
  To: Rob Herring
  Cc: Tomeu Vizoso, Oded Gabbay, Thomas Zimmermann, Frank Li, dri-devel,
	linux-kernel, kernel-janitors

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>
---
From static analysis.  Not tested.

 drivers/accel/ethosu/ethosu_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/ethosu/ethosu_gem.c b/drivers/accel/ethosu/ethosu_gem.c
index 473b5f5d7514..7b073116314b 100644
--- a/drivers/accel/ethosu/ethosu_gem.c
+++ b/drivers/accel/ethosu/ethosu_gem.c
@@ -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,
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH next] accel: ethosu: Fix shift overflow in cmd_to_addr()
  2025-10-29  5:30 [PATCH next] accel: ethosu: Fix shift overflow in cmd_to_addr() Dan Carpenter
@ 2026-02-18 22:30 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2026-02-18 22:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Tomeu Vizoso, Oded Gabbay, Thomas Zimmermann, Frank Li, dri-devel,
	linux-kernel, kernel-janitors

On Wed, Oct 29, 2025 at 08:30:11AM +0300, Dan Carpenter wrote:
> 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>
> ---
> >From static analysis.  Not tested.
> 
>  drivers/accel/ethosu/ethosu_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Missed this one. Now applied.

Rob

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-18 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29  5:30 [PATCH next] accel: ethosu: Fix shift overflow in cmd_to_addr() Dan Carpenter
2026-02-18 22:30 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox