All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Bivash Kumar Singh" <bivashraj750@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v4] Input: gunze: replace deprecated APIs and fix warning style
Date: Sun, 19 Jul 2026 17:54:36 +0000	[thread overview]
Message-ID: <20260719175437.153A81F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260719173700.4942-1-bivashraj750@gmail.com>

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 <bivashraj750@gmail.com>

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().

> 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

  reply	other threads:[~2026-07-19 17:54 UTC|newest]

Thread overview: 11+ 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
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
2026-07-19 17:37 ` [PATCH v4] " Bivash Kumar Singh
2026-07-19 17:54   ` sashiko-bot [this message]
2026-07-20  1:24   ` Dmitry Torokhov
2026-07-20  3:24 ` [PATCH v5] " Bivash Kumar Singh
2026-07-20  3:32   ` 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=20260719175437.153A81F00A3E@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.