Linux Input/HID development
 help / color / mirror / Atom feed
From: Linkai Gong <gonglinkai@kylinos.cn>
To: Linus Walleij <linusw@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Alistair Francis" <alistair@alistair23.me>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Mylène Josserand" <mylene.josserand@bootlin.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	gonglinkai@kylinos.cn
Subject: [PATCH] Input: cyttsp5 - clamp the HID report size before memcpy
Date: Tue,  1 Sep 2026 20:26:49 +0800	[thread overview]
Message-ID: <20260901122649.1173066-1-gonglinkai@kylinos.cn> (raw)

The size field comes from the device and is used as the memcpy()
length into response_buf, which is CY_MAX_INPUT bytes.

Fixes: 5b0c03e24a06 ("Input: Add driver for Cypress Generation 5 touchscreen")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
 drivers/input/touchscreen/cyttsp5.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/touchscreen/cyttsp5.c b/drivers/input/touchscreen/cyttsp5.c
index 9266c07314be..e878a02dc9b7 100644
--- a/drivers/input/touchscreen/cyttsp5.c
+++ b/drivers/input/touchscreen/cyttsp5.c
@@ -710,6 +710,7 @@ static irqreturn_t cyttsp5_handle_irq(int irq, void *handle)
 		size = 2;
 	} else {
 		report_id = ts->input_buf[2];
+		size = min(size, CY_MAX_INPUT);
 	}
 
 	switch (report_id) {
-- 
2.25.1


             reply	other threads:[~2026-09-01 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 12:26 Linkai Gong [this message]
2026-09-01 12:40 ` [PATCH] Input: cyttsp5 - clamp the HID report size before memcpy sashiko-bot
2026-09-04 10:31 ` Alistair

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=20260901122649.1173066-1-gonglinkai@kylinos.cn \
    --to=gonglinkai@kylinos.cn \
    --cc=alistair@alistair23.me \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=mylene.josserand@bootlin.com \
    /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