Re: [PATCH v2] Input: gunze: replace deprecated APIs and fix warning style
From: sashiko-bot@kernel.org
Date: 2026-07-19 05:53:57
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Strict parsing with kstrtoul() and an early return drops packets on non-digit coordinate data, potentially causing permanently stuck touch states. --
--- Patch [1]: [PATCH v2] Input: gunze: replace deprecated APIs and fix warning style ---commit 448e772e264a7d37aec51432b84a51cdf06f350f Author: Bivash Kumar Singh [off-list ref] Input: gunze: replace deprecated APIs and fix warning style This commit replaces the deprecated simple_strtoul() API with kstrtoul() and updates the logging style to use dev_warn(). It also adds an early return in the packet processing path if coordinate parsing fails.
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c index 2baeb4f3b941c..e9c028430420c 100644 --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -41,15 +41,24 @@ static void gunze_process_packet(struct gunze *gunze)
[ ... ]
- 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'; /*NULL-terminate X portion: "1234\0" */ + buf[GUNZE_MAX_LENGTH] = '\0'; /*NULL-terminate Y portion */ + + if (kstrtoul(buf + 1, 10, &x) || kstrtoul(buf + 6, 10, &y)) + return;
[Severity: High] Could this strict parsing with kstrtoul() and early return drop valid events and cause the touch state to get permanently stuck? Unlike simple_strtoul(), which stops parsing at the first non-digit character, kstrtoul() will return an error if the string contains trailing spaces or serial line noise. If a touch release packet (starting with 'R') contains non-digit padding, kstrtoul() will return an error and trigger this early return.
+ + 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);
Bypassing the BTN_TOUCH state update and input_sync() would cause the touchscreen to remain stuck in a pressed state until a subsequent valid packet is received. -- Sashiko AI review · https://sashiko.dev/#/patchset/20260719054121.5917-1-bivashraj750@gmail.com?part=1