Linux Input/HID development
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ranjan Kumar <kumarranja@chromium.org>
Cc: bleung@chromium.org, dusonlin@emc.com.tw, bentiss@kernel.org,
	 linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: elan_i2c - prevent division by zero on invalid device parameters
Date: Wed, 13 May 2026 14:00:33 -0700	[thread overview]
Message-ID: <agTlxHSZqSI8cnjK@google.com> (raw)
In-Reply-To: <20260513073908.3326178-1-kumarranja@chromium.org>

Hi Ranjan,

On Wed, May 13, 2026 at 07:39:08AM +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, y_traces, x_mm, or y_mm, it results in a fatal
> division-by-zero exception leading to a kernel panic during device probe.
> 

Neither crashing nor aborting probe with -EINVAL is great as we will not
be able to flash another firmware.

How do we get into this state? Is this something actually observed or
just theoretical?

> Add sanity checks to ensure these physical parameters are non-zero
> before performing the division. If invalid values are detected, log an
> error and return -EINVAL to gracefully abort the initialization and
> maintain system stability.

That is hardly "stability" for a laptop when its pointer is not working.

Thanks.

-- 
Dmitry

  reply	other threads:[~2026-05-13 21:00 UTC|newest]

Thread overview: 4+ 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 [this message]
2026-05-15  6:52   ` [PATCH v2] " Ranjan Kumar
2026-05-15  7:10     ` 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=agTlxHSZqSI8cnjK@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=bleung@chromium.org \
    --cc=dusonlin@emc.com.tw \
    --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