From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1F9C3DE42C for ; Mon, 4 May 2026 18:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777920897; cv=none; b=b7L8GuIU+ihqZKRvE4lrJUeZUaUWI3ZAXuHqhkcJDdZuR7yBimyucTQ2+ESINn8+SlRwEhgWlT7juqWEGONWmkb8yfYv9C8wrVM8sTVJAMR1HvczCpkZo/UFP6uZubd31Rq3hdcR2PEsA9FAQaGRLGdXEuEVVjviwZVKnr0GdY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777920897; c=relaxed/simple; bh=X6ZP4AbUQhy+1vK6aIjWYBb64FGoaXW4biQJ9vXhYmg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UXVKHfZwIqnPMtmUDj6mzI2jdfiKswAkGz3fWymg0ImPKddLgqd+5hqorYR4FM2hYf4yctDgaJyWVjq2UFVWJmLu23EhTdTvAGulI52WBxiaJDCwyAMiUTZ6Y/aa1mRc0D/ULgXTfZNLeNF2vqigle/qeNQm/UMw4KBEp2Cz+Lg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OhEnL2ps; arc=none smtp.client-ip=74.125.82.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OhEnL2ps" Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-2ecf9e398f4so10320026eec.1 for ; Mon, 04 May 2026 11:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777920893; x=1778525693; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dW2xmDUvOx56Zunc2V2z3nQF+PhXC6PyTRu9F8brLyc=; b=OhEnL2psm1IRKY7LoVKxmvCGv/CRp3EjHaUjIu6k97BBg4sWDPBkbyP7RGN3eZ7Wgv cGGeQyg6ngfKOt6Eb3Ht/YCGXhgECWm8sXjyMbq8VFnNuOEUU+Px6p+qS6m1cKibQ25y ueLRc/1E57bOBJFYU2ljquV8La3AtrXj84bQkADu2SavoYQ4CAoWbRhkC4mIkHNFBD1Z riXiRZSXBr6cWKb0FlNxU66OpDP/wmngwoyq+iKyicDjAPGCs9k1XsJpRh8yLuUHq5V7 V2TuXAGJFjqzzNIUa492UgfVSsBCvH68UexUtjC5SZ9tzzB/u59ArEs/yxd2cUVF3el7 zuPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777920893; x=1778525693; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dW2xmDUvOx56Zunc2V2z3nQF+PhXC6PyTRu9F8brLyc=; b=Rlv7UFPdZ5nMZ2UjsOANtJygvHp4s6Os67lEU/AU6+FWrGETo2iKZVHh1Oq0xFM/bm Fwv9af79BFRGIZqgVmsLA/rF9DXkAmBpD99OG8IowO8mouN60PkmJfd6GSe+o/21zdgU nVEGRPQPPQdrbY0SRzQgyNfetXvv74ggEWLH/Z+oTYx1JZjdH6IVToQ4OaEShUuQldBF OcbSFXrT5ZN++QB6zVCabFNUJfLz+FGgDvM2X+8uW1le1I5WKNyhjqvjCgM5m4IyxTKm nw5bs6DVPuIgUla7YXyy4R1YdxJ8ysgvJaqyZcmEPXNaK2ufpm0tdZDy4y57x9wXPDcr XfJg== X-Forwarded-Encrypted: i=1; AFNElJ8deDuXA/OBvo+pYxdiCa4k88Byckvp4szx9PTVFHQtp74ElH2h6Ea97YF+KQTzW+AmqktIQTcNc3M81ms=@vger.kernel.org X-Gm-Message-State: AOJu0YxtQXEZ2COjtqTE+qDeIy9Vf+oval/3dV+7R/CGyiO/PJczuYDV Gz/gS1CzP3SL8f3FNojzXIL4GhRtLUWLrXN7q1VHt7P1tdtINOXfldL3 X-Gm-Gg: AeBDievfmk//xglK2rs6wwn61PSropxnyHfEL1W+duJ0F3uNnKFhSlyaNkIwN9sRqt4 COtuGe/O0J96NEbp2Zz3bKUGRI1Lyc/wflCh5sIfePpKdJwRMT2rQcPhY4ZWrZNq66X4DOOTtvv az/QFiYqKn+mXQBOjUJrgKIiHEQTqgAau3qc16021GFx19sLvWUSzu9LNS75SPEEP5cfs0RSiLl aU1dGTTZv8eHxuZUguq2hZLCacoL4xMcjcn8Hz+q3joEqqHktAc6/nsKpbI61LrvNn3en1aaBy1 ZOPe9lUpk9RQ1apD30ICoEjifMUb3oxhuv8OoiSySpd9lNY07qW3+egTxlTFvyTkPsE3lzIHygH pbp/ZhY6wp+6mCvg9WazG/SEEErr9pgBtiGlRfrN+mRUQqZT1TplnS+mv82Je0M5OQml/3aeSMS LL4vnUBOiaukk+ly3cZEMHinRLd0sbxJY/P8biEssVk0Asvgnq1a08LmHPQfNnOcK6kiZhYf2Do M7XazpCRPrSBrCxs3GAoahVig== X-Received: by 2002:a05:7300:2316:b0:2de:c5ca:c1f3 with SMTP id 5a478bee46e88-2efb7ad86b0mr4848561eec.4.1777920892917; Mon, 04 May 2026 11:54:52 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:5b87:9b19:32e2:2981]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2ee3bf6812asm16830718eec.28.2026.05.04.11.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2026 11:54:52 -0700 (PDT) From: Dmitry Torokhov To: Nick Dyer , linux-input@vger.kernel.org Cc: Ricardo Ribalda , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/3] Input: atmel_mxt_ts - fix boundary check in mxt_prepare_cfg_mem Date: Mon, 4 May 2026 11:54:45 -0700 Message-ID: <20260504185448.4055973-1-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When a configuration file provides an object size that is larger than the driver's known mxt_obj_size(object), the driver intends to discard the extra bytes. The loop iterates using for (i = 0; i < size; i++). Inside the loop, the condition to skip processing extra bytes is: if (i > mxt_obj_size(object)) continue; Since i is a 0-based index, the valid indices for the object are 0 through mxt_obj_size(object) - 1. When i == mxt_obj_size(object), the condition evaluates to false, and the code processes the byte instead of discarding it. This causes the code to calculate byte_offset = reg + i - cfg->start_ofs and writes the byte there, overwriting exactly one byte of the adjacent instance or object. Update the boundary check to skip extra bytes correctly by using >=. Fixes: 50a77c658b80 ("Input: atmel_mxt_ts - download device config using firmware loader") Cc: stable@vger.kernel.org Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d62bf2c95578..28b2bd889c70 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1503,7 +1503,7 @@ static int mxt_prepare_cfg_mem(struct mxt_data *data, struct mxt_cfg *cfg) } cfg->raw_pos += offset; - if (i > mxt_obj_size(object)) + if (i >= mxt_obj_size(object)) continue; byte_offset = reg + i - cfg->start_ofs; -- 2.54.0.545.g6539524ca2-goog