From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Pooyan Azad <pooyan.azadparvar@gmail.com>
Cc: Uwe Kleine-König <u.kleine-koenig@baylibre.com>,
Muhammad Bilal <meatuni001@gmail.com>,
Herlangga Maulani <w1zardsec@proton.me>,
Rob Herring <robh@kernel.org>,
Jeffrey Lin <jeffrey.lin@rad-ic.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] Input: raydium_i2c_ts - validate report parameters
Date: Mon, 23 Nov 2026 20:42:43 -0800 [thread overview]
Message-ID: <4ab84021a5d175f5d3793e52fd818a21@gmail.com> (raw)
In-Reply-To: <26ac42dd18a98c4928cbe7f6b6adb4b396be4c8e.1790612085.git.pooyan.azadparvar@gmail.com>
Hi Pooyan,
On Mon, Sep 28, 2026 at 06:26:16PM +0200, Pooyan Azad wrote:
...
> + if (data_info.pkg_size < RM_PACKET_CRC_SIZE) {
> + dev_err(&client->dev,
> + "invalid report sizes: packet=%u contact=%u\n",
> + data_info.pkg_size, data_info.tp_info_size);
> + return -EINVAL;
> + }
> +
> + report_size = data_info.pkg_size - RM_PACKET_CRC_SIZE;
> + if (data_info.tp_info_size < RM_MIN_CONTACT_SIZE ||
> + data_info.tp_info_size > report_size ||
> + report_size / data_info.tp_info_size > RM_MAX_TOUCH_NUM) {
> + dev_err(&client->dev,
> + "invalid report sizes: packet=%u contact=%u\n",
> + data_info.pkg_size, data_info.tp_info_size);
> + return -EINVAL;
> + }
I folded these two checks and duplicate error messages using
check_sub_overflow():
if (check_sub_overflow(data_info.pkg_size, RM_PACKET_CRC_SIZE,
&report_size) ||
data_info.tp_info_size < RM_MIN_CONTACT_SIZE ||
data_info.tp_info_size > report_size ||
report_size / data_info.tp_info_size > RM_MAX_TOUCH_NUM) {
dev_err(&client->dev,
"invalid report sizes: packet=%u contact=%u\n",
data_info.pkg_size, data_info.tp_info_size);
return -EINVAL;
}
Applied the updated patch to for-linus.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-11-24 4:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 11:44 [PATCH] Input: raydium_i2c_ts - validate report parameters Pooyan Azad
2026-09-27 17:30 ` Muhammad Bilal
2026-09-27 17:58 ` Pooyan Azadparvar
2026-09-28 2:38 ` Dmitry Torokhov
2026-09-28 6:04 ` Pooyan Azadparvar
2026-09-28 16:26 ` [PATCH v2 0/3] Input: raydium_i2c_ts report handling fixes Pooyan Azad
2026-09-28 16:26 ` [PATCH v2 1/3] Input: raydium_i2c_ts - validate report parameters Pooyan Azad
2026-11-24 4:42 ` Dmitry Torokhov [this message]
2026-11-24 7:31 ` Pooyan Azadparvar
2026-09-28 16:26 ` [PATCH v2 2/3] Input: raydium_i2c_ts - resize report buffer after firmware update Pooyan Azad
2026-09-28 16:26 ` [PATCH v2 3/3] Input: raydium_i2c_ts - defer report buffer allocation Pooyan Azad
2026-10-07 9:04 ` [PATCH v2 0/3] Input: raydium_i2c_ts report handling fixes Pooyan Azadparvar
2026-11-04 13:43 ` Pooyan Azadparvar
2026-11-24 4:49 ` Dmitry Torokhov
2026-11-24 20:40 ` [PATCH v3] Input: raydium_i2c_ts - use a fixed-size report buffer Pooyan Azad
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=4ab84021a5d175f5d3793e52fd818a21@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=jeffrey.lin@rad-ic.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meatuni001@gmail.com \
--cc=pooyan.azadparvar@gmail.com \
--cc=robh@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=w1zardsec@proton.me \
/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.