From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795943470; b=JhqKS3INwPH0RJgK/9bOa2SROpGghACC4miSyDWTYPwID/HfQoNvO1YWyZipI2rh3Aw5 nLg8Tg53Kuz5qoEcWMmYnIQowmI1q2q8YTKjAwZj85neFFY3ct/KUkqeH8h9exqbdHIJe WUuvvLytdcecBLRsAMXvGqAi9UwW8b5pXLy87aSQDF15NT+8TA3jSQaeKgSeSmRPGS8+y DBg3TLo8V6BpxXKNXRAe4FeqfDcOYJZsAoV5CPfrN41sBmmSMRZjugaF/gDjeevGv/ZQW 1RGt2maWlqkfFMuu1+agHd+Jl5AUGEUJ6sn32Ck2Bfxd7r0g6WnrRJtkDi8x1aG7zCw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795943470; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=CkeRKnH1KIPhwlTGtoP+nHL0Qs+M34w1p7uvC/2Skyk=; b=F7SoCPS53MZ9ESFOi5DBpgy7plS4ZghzgldNz/PBuQmL5vFcJG3d+WfluPNsx5wTM1VE CVOezgHlGpK8JfaOlAE7fnoBZtrKGofrHofTVHHZvJPXBYynElB0IwQMh2TQG/d5be8WI zKeCuzB9jARmOhgkv/6MSQq6Q/iM6t4GmsE05Ljy7jH+4m98B/IEuNbW3lfBGzeTmPjj6 iekB7aNTp2NNTU4EIwO2ExR2QRlwA52OM67GpCGqipTgo7pFvDrCRcV72qBFHr4LMYQB5 5Pnhysc5cE8OEuo3HDRHmgpPW7S8tC2foxXoOUj48IbFdqP+X4/0BByT240xRvkKsBQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZS3X+BRn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B770A606A325 for ; Sun, 29 Nov 2026 09:11:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZS3X+BRn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 460031F00897; Sun, 29 Nov 2026 09:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795943470; bh=CkeRKnH1KIPhwlTGtoP+nHL0Qs+M34w1p7uvC/2Skyk=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ZS3X+BRn+dvctTKOnpPu15g2MGelJM+VOyvMXtHrAO4ihALCU7B45At4//Cd+GwUa 6Ahs2voQF7RKr3OjsQ9DA8pcY8z3lRUaoaUxeZXoCBEPn/3BxybL/qMIOmUJW1hOHj MXMvdg2wQ4oQRAX/QBAu+DM/J3ERKq1m7b5/OSE3xnGok39ikuInq4hEb+AIRL0DFo N3WAjOsEEPcXD+W3AhxScMyM/7I+86pJ2+AAlBdrO6cC4/i0JplT7Kdd8KDRgpkXvZ MvQo3DXR9KjHpsnVj3W+RJSf4ufgDwp42wlqSGgShuAYfhaHxN03YdcC/mK8H7/44r OemdVG8e6Ycxw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] Input: ili210x - widen firmware address types to u32 Reply-To: sashiko-reviews@lists.linux.dev To: "Aibing Chen" Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261129090341.1179-1-chenaibing@cmss.chinamobile.com> References: <20261129090341.1179-1-chenaibing@cmss.chinamobile.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 09:11:09 +0000 X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] Input: ili210x - u16 parameters in ili210x_firmware_update() truncate end addresses - [Low] Input: ili210x - missing Fixes trailer for u16 firmware address truncation -- commit 367981bad9bc63de88c9f1f6d4141cec44ab2560 Author: Aibing Chen > Input: ili210x - widen firmware address types to u32 > > The firmware write command uses a 3-byte address field, but the > address variables (end, start, fw_addr, ac_end, df_end) are typed as > u16, which truncates addresses at 0xffff. The firmware blob validation > allows the last block to end at SZ_64K (0x10000), so df_end can be > 0x10000 -- which truncates to 0 in a u16, making the upper byte of the > 3-byte address always 0. > > Widen the address types to u32 so that the full 3-byte address range > is usable and the upper byte in the write command reflects the actual > address. For the CRC field, write 0x00 for the upper byte directly: > CRC-CCITT always produces a 16-bit value, so the upper byte is > constant, which also silences the Smatch warning about shifting a > 16-bit value by 16. > > Suggested-by: sashiko-bot > Signed-off-by: Aibing Chen [Severity: Low] This fixes a bug in ili251x firmware update support. Should this include: Fixes: c6ac8f0b4ca9 ("Input: ili210x - add ili251x firmware update suppor= t") > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscr= een/ili210x.c > index 03e4451d6393c..2e4681813731b 100644 > --- a/drivers/input/touchscreen/ili210x.c > +++ b/drivers/input/touchscreen/ili210x.c [ ... ] > @@ -868,7 +868,7 @@ static ssize_t ili210x_firmware_update_store(struct d= evice *dev, > { > struct i2c_client *client =3D to_i2c_client(dev); > const char *fwname =3D ILI251X_FW_FILENAME; > - u16 ac_end, df_end; > + u32 ac_end, df_end; > int error; > =20 > const struct firmware *fw __free(firmware) =3D NULL; [Severity: High] Does ili210x_firmware_update() still truncate ac_end and df_end to u16? ili210x_firmware_update_store() passes ac_end and df_end through ili210x_firmware_update() before reaching ili210x_do_firmware_update(): drivers/input/touchscreen/ili210x.c:ili210x_firmware_update() { static ssize_t ili210x_firmware_update(struct device *dev, const u8 *fwbuf, u16 ac_end, u16 df_end) { ... error =3D ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end); } When df_end is SZ_64K (0x10000), ili210x_firmware_update() truncates it back to 0. In ili251x_firmware_write_to_ic(), start is 0xf000 and end is 0, so the u32 length expression end - start - 2 wraps around to 0xffff0ffe and causes crc_ccitt() to read ~4 GiB out of bounds past the 64 KiB fwbuf buffer. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129090341.1179= -1-chenaibing@cmss.chinamobile.com?part=3D1