Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 931AE361657; Thu, 20 Aug 2026 16:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787243318; cv=none; b=KCIfsG28ncKpJqjsCgnwalGx8Pwsyl8zenECvkJebNDkjqmOfd/wIoNWJfmSLkQCmmpOL+U4wKRwRNJE1XqdrxqetfLR3e8XFhQEj/iJeCEpWjjnGZ/WlLtyggQHOpZ72Hvo6ftaUGEz3g3ieMmbiVEtbWd/9SnndtSdM8IFLkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787243318; c=relaxed/simple; bh=vA7ZRBd3l67T0pdskzUWocxoiU+zal9d0mjRcH/1WuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GW/Hcs3It93hPbostaWgFVold+UxqF2CN2EZJLjOQeMJFh767xsCPzk/l7eqNwQwv/ZXgOI7I495WfYQl4SjiEuC8of5YVr4qiKs7fh2C+d8soFUFMs1YhCI0Rdou2HZUlKYhKuyE3dw36FRIoYP1w3gj60WgnlaysE3rRtbM5A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=axDY17+k; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="axDY17+k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C96D51F000E9; Thu, 20 Aug 2026 16:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787243317; bh=964ZwUp5KnGyQzA0gxCQ0hizeJ2oOg6VDKU6ghvvmCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=axDY17+kaUDP+sLpEM6iR8t6kDr5PPhZozUl2166EEmV5Tcfqmr3WCcBd896CUKef 9QzU1LSegId0Sn7on2lN8TV4VH9eNHwJAqtNwzpB3M2MLAKnjlyJv4K2ix58/QWviS E/73NeaSSfDXqfkagbeF2bf5/6Jf+BMLIaChmuaI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, sashiko-bot@kernel.org, Bryam Vargas , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.15 053/272] Input: mms114 - fix touch indexing for MMS134S and MMS136 Date: Thu, 20 Aug 2026 16:53:57 +0200 Message-ID: <20260820145232.804320303@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145231.229664293@linuxfoundation.org> References: <20260820145231.229664293@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov [ Upstream commit a6ac4e24c1a8a533bb61035184fdcc7eede4cc8d ] The MMS134S and MMS136 touch controllers have an event size of 6 bytes rather than 8 bytes. When __mms114_read_reg() reads the touch data packet from the device into the touch buffer, the events are packed tightly at 6-byte intervals. However, the driver iterates through the events using standard C array indexing (touch[index]), where each element is sizeof(struct mms114_touch) (8 bytes) apart. As a result, any touch events beyond the first one are read from incorrect offsets and parsed improperly. Fix this by explicitly calculating the byte offset for each touch event based on the device's specific event size. Fixes: 53fefdd1d3a3 ("Input: mms114 - support MMS136") Fixes: ab108678195f ("Input: mms114 - support MMS134S") Reported-by: sashiko-bot@kernel.org Assisted-by: Antigravity:gemini-3.5-flash Reviewed-by: Bryam Vargas Link: https://patch.msgid.link/20260616050912.1531241-1-dmitry.torokhov@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/mms114.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -196,7 +196,9 @@ static irqreturn_t mms114_interrupt(int struct mms114_data *data = dev_id; struct input_dev *input_dev = data->input_dev; struct mms114_touch touch[MMS114_MAX_TOUCH]; + struct mms114_touch *t; int packet_size; + int event_size; int touch_size; int index; int error; @@ -214,17 +216,22 @@ static irqreturn_t mms114_interrupt(int /* MMS136 has slightly different event size */ if (data->type == TYPE_MMS134S || data->type == TYPE_MMS136) - touch_size = packet_size / MMS136_EVENT_SIZE; + event_size = MMS136_EVENT_SIZE; else - touch_size = packet_size / MMS114_EVENT_SIZE; + event_size = MMS114_EVENT_SIZE; + + touch_size = packet_size / event_size; error = __mms114_read_reg(data, MMS114_INFORMATION, packet_size, (u8 *)touch); if (error < 0) goto out; - for (index = 0; index < touch_size; index++) - mms114_process_mt(data, touch + index); + for (index = 0; index < touch_size; index++) { + t = (struct mms114_touch *)((u8 *)touch + index * event_size); + + mms114_process_mt(data, t); + } input_mt_report_pointer_emulation(data->input_dev, true); input_sync(data->input_dev);