[PATCH 1/5] m68k: Fix atari mouse movement

Michael Schmitz <[email protected]>
Newsgroups org.kernel.vger.linux-m68k
Message-ID <[email protected]>
From: Miro Kropacek <[email protected]>

Kernels are built with -funsigned-char since version 6.2, resulting
in signed mouse position deltas getting misinterpreted as unsigned.

Cast deltas passed in (unsigned) scancode buffer to correctly
interpret sign.

Fixes: 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")
Link: https://lists.debian.org/debian-68k/2026/08/msg00000.html
Signed-off-by: Miro Kropacek <[email protected]>
Reviewed-by: Michael Schmitz <[email protected]>
---
 drivers/input/mouse/atarimouse.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
index b1219cc4d9a2..351aab69e905 100644
--- a/drivers/input/mouse/atarimouse.c
+++ b/drivers/input/mouse/atarimouse.c
@@ -70,9 +70,12 @@ static void atamouse_interrupt(char *buf)
 	atari_mouse_buttons = buttons;
 #endif
 
-	/* only relative events get here */
-	dx = buf[1];
-	dy = buf[2];
+	/* only relative events get here; the IKBD sends signed 8-bit
+	 * deltas, and the kernel builds with -funsigned-char since 6.2,
+	 * so an explicit signed cast is required
+	 */
+	dx = (s8)buf[1];
+	dy = (s8)buf[2];
 
 	input_report_rel(atamouse_dev, REL_X, dx);
 	input_report_rel(atamouse_dev, REL_Y, dy);
-- 
2.17.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.