Re: [PATCH v4] Input: gunze: replace deprecated APIs and fix warning style
From: sashiko-bot@kernel.org
Date: 2026-07-19 17:54:37
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: New issues: - [High] Un-ratelimited dev_warn() calls in the interrupt handler lead to severe kernel log spam (dmesg flooding). - [High] Replacing simple_strtoul() with kstrtoul() causes a behavioral regression due to strict parsing requirements. Pre-existing issues: - [High] Unconditional reporting of fallback coordinates on parse failure causes out-of-bounds values and cursor jumps. --
--- Patch [1]: [PATCH v4] Input: gunze: replace deprecated APIs and fix warning style ---commit 7f14b2c0978a817cc80d8103302866bba7c3bf3f Author: Bivash Kumar Singh [off-list ref] Input: gunze: replace deprecated APIs and fix warning style This commit replaces simple_strtoul() with kstrtoul() by copying the packet data into a local NUL-terminated buffer first. It also updates the logging style from printk() to dev_warn().
quoted hunk ↗ jump to hunk
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c --- a/drivers/input/touchscreen/gunze.c +++ b/drivers/input/touchscreen/gunze.c@@ -41,15 +41,26 @@ static void gunze_process_packet(struct gunze *gunze) struct input_dev *dev = gunze->dev; + char buf[GUNZE_MAX_LENGTH + 1]; + unsigned long x = 0, y = 0; 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))
[Severity: High] In gunze_process_packet(), kstrtoul() requires a perfectly clean string without trailing spaces or non-digit characters, whereas simple_strtoul() would successfully stop parsing at the first non-digit. If the legacy fixed-width hardware protocol pads coordinates with spaces or contains noisy data, will kstrtoul() reject the entire packet and return -EINVAL, resulting in a loss of valid touch coordinate data?
+ dev_warn(&gunze->serio->dev, "failed to parse X coordinate\n"); + if (kstrtoul(buf + 6, 10, &y)) + dev_warn(&gunze->serio->dev, "failed to parse Y coordinate\n");
[Severity: High] The commit message mentions that release packets can contain noisy data, meaning parsing failures are an expected event. Because gunze_process_packet() is called directly from the hardware interrupt handler, could these un-ratelimited dev_warn() calls flood the kernel log and cause high CPU overhead when users interact with the touchscreen?
+ + input_report_abs(dev, ABS_X, x); + input_report_abs(dev, ABS_Y, 1024 - y);
[Severity: High] This is a pre-existing issue, but when parsing fails, the y coordinate falls back to 0. Does unconditionally reporting ABS_Y as 1024 - 0 cause the touch cursor to instantaneously jump out of bounds and trigger spurious clicks or swipe artifacts on the device?
input_report_key(dev, BTN_TOUCH, gunze->data[0] == 'T'); input_sync(dev); }
-- Sashiko AI review · https://sashiko.dev/#/patchset/20260719173700.4942-1-bivashraj750@gmail.com?part=1