From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ranjan Kumar <kumarranja@chromium.org>
Cc: bleung@chromium.org, bentiss@kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] Input: elan_i2c - prevent division by zero and arithmetic underflow
Date: Mon, 22 Jun 2026 22:31:51 -0700 [thread overview]
Message-ID: <ajoaQ6D5qDKI8YlL@google.com> (raw)
In-Reply-To: <20260612060339.3829666-1-kumarranja@chromium.org>
On Fri, Jun 12, 2026 at 06:03:39AM +0000, Ranjan Kumar wrote:
> The Elan I2C touchpad driver queries the device for its physical
> dimensions and trace counts to calculate the device resolution and width.
> However, if the device firmware or device tree provides invalid zero
> values for x_traces or y_traces, it results in a fatal division-by-zero
> exception leading to a kernel panic during device probe.
>
> Add checks to ensure these parameters are non-zero before performing
> the division. If invalid trace values are detected, fall back to a safe
> default of 1.
>
> Additionally, prevent an arithmetic underflow in the touch reporting
> logic. Previously, if the calculated or fallback width was smaller than
> ETP_FWIDTH_REDUCE (90), the subtraction would underflow, resulting in a
> massive unsigned integer being reported to userspace. Clamp the adjusted
> width to a minimum of 0 to safely handle small physical dimensions and
> fallback scenarios.
>
> Completing the probe with safe fallback values ensures the sysfs nodes
> are created, keeping the firmware update path intact so a recovery
> firmware can be flashed to the device.
>
> Fixes: 6696777c6506 ("Input: add driver for Elan I2C/SMbus touchpad")
> Fixes: e3a9a1290688 ("Input: elan_i2c - do not query the info if they are provided")
> Signed-off-by: Ranjan Kumar <kumarranja@chromium.org>
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2026-06-23 5:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 7:39 [PATCH] Input: elan_i2c - prevent division by zero on invalid device parameters Ranjan Kumar
2026-05-13 21:00 ` Dmitry Torokhov
2026-05-15 6:52 ` [PATCH v2] " Ranjan Kumar
2026-05-15 7:10 ` sashiko-bot
2026-05-18 6:26 ` [PATCH v3] " Ranjan Kumar
2026-06-09 5:18 ` Dmitry Torokhov
2026-06-12 6:03 ` [PATCH v4] Input: elan_i2c - prevent division by zero and arithmetic underflow Ranjan Kumar
2026-06-23 5:31 ` Dmitry Torokhov [this message]
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=ajoaQ6D5qDKI8YlL@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=bentiss@kernel.org \
--cc=bleung@chromium.org \
--cc=kumarranja@chromium.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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