From: sashiko-bot@kernel.org
To: "Bivash Kumar Singh" <bivashraj750@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] Input: gunze: replace deprecated APIs and fix warning style
Date: Sat, 18 Jul 2026 19:12:13 +0000 [thread overview]
Message-ID: <20260718191213.ED6131F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260718190040.10613-1-bivashraj750@gmail.com>
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 <bivashraj750@gmail.com>
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.
> 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
next prev parent reply other threads:[~2026-07-18 19:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-18 19:00 [PATCH] Input: gunze: replace deprecated APIs and fix warning style Bivash Kumar Singh
2026-07-18 19:12 ` sashiko-bot [this message]
2026-07-19 5:41 ` [PATCH v2] " Bivash Kumar Singh
2026-07-19 5:53 ` sashiko-bot
2026-07-19 6:02 ` [PATCH v3] " Bivash Kumar Singh
2026-07-19 6:13 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260718191213.ED6131F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bivashraj750@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox