From: David Heidelberg <david@ixit.cz>
To: Lee Jones <lee@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andi Shyti <andi@etezian.org>, Rob Herring <robh@kernel.org>,
Javier Martinez Canillas <javier@osg.samsung.com>,
linux-input@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 05/10] Input: stmfts - fix i2c_smbus_read_i2c_block_data() check in status sysfs
Date: Fri, 27 Nov 2026 21:35:34 +0100 [thread overview]
Message-ID: <8189547f-8ca7-47ab-b20c-a85a86a6ea1e@ixit.cz> (raw)
In-Reply-To: <20261127201050.3532488-6-lee@kernel.org>
On 27/11/2026 21:09, Lee Jones wrote:
> i2c_smbus_read_i2c_block_data() returns the positive byte count on
> success or a negative error code on failure. stmfts_sysfs_read_status()
> checks if (err) and returns err directly, so a normal 4-byte read
> returns 4 without formatting buf (exposing unpopulated sysfs buffer
> bytes), while a 0-byte read formats uninitialised stack memory.
>
> Return negative errors immediately and require sizeof(status) bytes to
> be read, matching stmfts_read_system_info().
>
> Fixes: 78bcac7b2ae1 ("Input: add support for the STMicroelectronics FingerTip touchscreen")
> Closes: https://sashiko.dev/#/bug/linux-bd87edf0-6f79-4318-8780-d69205787e7d
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
> drivers/input/touchscreen/stmfts.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
> index 2054c2254947..aada03f96940 100644
> --- a/drivers/input/touchscreen/stmfts.c
> +++ b/drivers/input/touchscreen/stmfts.c
> @@ -699,9 +699,12 @@ static ssize_t stmfts_sysfs_read_status(struct device *dev,
>
> err = i2c_smbus_read_i2c_block_data(sdata->client, STMFTS_READ_STATUS,
> sizeof(status), status);
> - if (err)
> + if (err < 0)
> return err;
>
> + if (err != sizeof(status))
> + return -EIO;
> +
> return sysfs_emit(buf, "%#02x\n", status[0]);
> }
>
Reviewed-by: David Heidelberg <david@ixit.cz>
next prev parent reply other threads:[~2026-11-27 20:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 20:09 [PATCH 00/10] Input: Fix OOB writes, UAFs, NULL derefs, and suspend work bugs (batch 2) Lee Jones
2026-11-27 20:09 ` [PATCH 01/10] Input: adi - prevent off-by-one write in adi_read_packet() Lee Jones
2026-11-27 20:09 ` [PATCH 02/10] Input: adi - validate axis and button counts in adi_id_decode() Lee Jones
2026-11-27 20:09 ` [PATCH 03/10] Input: xpad - cancel presence work on xpad360w_start_input() failure Lee Jones
2026-11-27 20:09 ` [PATCH 04/10] Input: aw86927 - use devm_work_autocancel() for haptics play work Lee Jones
2026-11-27 20:09 ` [PATCH 05/10] Input: stmfts - fix i2c_smbus_read_i2c_block_data() check in status sysfs Lee Jones
2026-11-27 20:35 ` David Heidelberg [this message]
2026-11-27 20:10 ` [PATCH 06/10] Input: xen-kbdfront - check info->ptr and info->kbd before dereferencing Lee Jones
2026-11-27 20:10 ` [PATCH 07/10] Input: drv2665 - disable haptics work across suspend and resume Lee Jones
2026-11-27 20:10 ` [PATCH 08/10] Input: drv2667 " Lee Jones
2026-11-27 20:10 ` [PATCH 09/10] Input: goodix_berlin_i2c - check i2c_get_match_data() for NULL Lee Jones
2026-11-27 20:10 ` [PATCH 10/10] Input: goodix_berlin_spi - validate ic_data and SPI max transfer size Lee Jones
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=8189547f-8ca7-47ab-b20c-a85a86a6ea1e@ixit.cz \
--to=david@ixit.cz \
--cc=alexandre.torgue@foss.st.com \
--cc=andi@etezian.org \
--cc=dmitry.torokhov@gmail.com \
--cc=javier@osg.samsung.com \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh@kernel.org \
--cc=stable@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
all inboxes | Powered by JetHome®