Thread (12 messages) 12 messages, 3 authors, 1d ago

Re: [PATCH v3] Input: gunze: replace deprecated APIs and fix warning style

From: sashiko-bot@kernel.org
Date: 2026-07-19 06:13:04

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The newly added early return on coordinate parsing failure drops critical touch state transitions (like touch releases), causing stuck touches.
--
--- Patch [1]: [PATCH v3] Input: gunze: replace deprecated APIs and fix warning style ---
commit 7585c5c9a9ed51c8709aeaa8875aeb5e7e1646b2
Author: Bivash Kumar Singh [off-list ref]

Input: gunze: replace deprecated APIs and fix warning style

This commit replaces deprecated simple_strtoul calls with kstrtoul and adds an
early return for parsing failures. It also updates the logging from printk to
dev_warn using the serio device.
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 2baeb4f3b941c..0e8131cad647e 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -41,15 +41,24 @@ static void gunze_process_packet(struct gunze *gunze)
 {
 	struct input_dev *dev = gunze->dev;
+	char buf[GUNZE_MAX_LENGTH + 1];
+	unsigned long x, y;
 
 	if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' ||
 		(gunze->data[0] != 'T' && gunze->data[0] != 'R')) {
-		printk(KERN_WARNING "gunze.c: bad packet: >%.*s<\n", GUNZE_MAX_LENGTH, gunze->data);
+		dev_warn(&gunze->serio->dev, "bad packet: >%.*s<\n", GUNZE_MAX_LENGTH, gunze->data);
 		return;
 	}
 
-	input_report_abs(dev, ABS_X, simple_strtoul(gunze->data + 1, NULL, 10));
-	input_report_abs(dev, ABS_Y, 1024 - simple_strtoul(gunze->data + 6, NULL, 10));
+	memcpy(buf, gunze->data, GUNZE_MAX_LENGTH);
+	buf[5] = '\0';		/* NUL-terminate X portion: "1234\0" */
+	buf[GUNZE_MAX_LENGTH] = '\0';	/* NUL-terminate Y portion */
+
+	if (kstrtoul(buf + 1, 10, &x) || kstrtoul(buf + 6, 10, &y))
+		return;
[Severity: High]
Does this early return risk dropping critical touch state transitions, such as
touch releases, causing stuck touches?

If a release packet ('R') contains unparseable coordinates (such as space
padding or noise), parsing will fail and trigger this early return.

Because the return bypasses the input_report_key call for BTN_TOUCH and the
subsequent input_sync call, the release event would be silently dropped.

Could this leave the touchscreen desynchronized and permanently stuck in the
pressed state?
+
+	input_report_abs(dev, ABS_X, x);
+	input_report_abs(dev, ABS_Y, 1024 - y);
 	input_report_key(dev, BTN_TOUCH, gunze->data[0] == 'T');
 	input_sync(dev);
 }
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260719060238.6440-1-bivashraj750@gmail.com?part=1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help