Re: [PATCH] Input: gunze: replace deprecated APIs and fix warning style
From: sashiko-bot@kernel.org
Date: 2026-07-18 19:12:14
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Replacing simple_strtoul() with kstrtoul() breaks packet parsing by unconditionally returning an error, dropping all touch events. --
--- Patch [1]: [PATCH] Input: gunze: replace deprecated APIs and fix warning style ---commit c6cb2e487b7cdb132629587d8da300e20e580c31 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 on parsing failures. It also updates the printk warning to use dev_warn() with the serio device.
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c index 2baeb4f3b941c..38450cabdd113 100644 --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c@@ -41,15 +41,19 @@ struct gunze { 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)); + if (kstrtoul(gunze->data + 1, 10, &x) || kstrtoul(gunze->data + 6, 10, &y)) + return;
[Severity: High] Does this replacement break packet parsing by unconditionally returning an error? The kstrtoul() API strictly requires the parsed string to be NUL-terminated and contain no trailing non-digit characters other than an optional newline. Because the input data is a comma-separated string like "T1234,5678" and the buffer is not NUL-terminated, kstrtoul() will encounter the comma when parsing the X coordinate and return -EINVAL. It will also fail when parsing the Y coordinate due to the missing NUL terminator. This early return will unconditionally trigger on every valid touch event, causing all packets to be dropped and rendering the touchscreen unusable.
+ + 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/20260718190040.10613-1-bivashraj750@gmail.com?part=1