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=1795938184; b=THbWCi9i9qgAIbbQ17+GWUvfgiM8CLHx1TZ71/2pE8RGgDP8eFy5ONGHIyz8rvytf2us NMFYHixteP2XuYoSgWviRt4WEItgU5WjJmIB4PE2u2ac1MRSYb/XW6q790tExeN/MZmwM wPuwYxA4D/uLHPJieAmc1HHiZLjuIIEDZTRTVPIQexT2EkXMt4azgNQ2lbFx8xqSyAy2G w0dKdTrCo28qMBBemWMduJD/heyPz0CWUHWCxl11fYQrIpqk3XPiW+NtoV3E0ZRsBYDUY W4WqN1rVdqoVyiFHy730wiLiB2zg5ZECWVm2QHTIj1IOPk49EES33F+fKZroPy6LNiw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795938184; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=x4Ta8EUWdeQmm7+pPDE0foMnCRbcP/a+ZfaDQdy4yC8=; b=BfL5QoPF6ABiNb6ygS2QniKtRgpx+oI9HaYlLulOijKEKqB6tBPFAYyvHDlP8jKG+Y9o 7eCb/nRJwfMPlWSJboT/vjFrGJ0FZCTlTanK2s6x3XHXzlwUZIH7JPvrQ5prlchCPTK/5 tiBKhCfPcf3zyAJRA6vD22ow5lQ3gkAxDUrexS2nm25hSrplQS4Gm9v0y7WuQCcORA8MU RIyQSujJYAwX66EKSwIGHQGDaLJBb8PMP/ctEnp+0f00WP/KeeyfxzvgeWO/dam9l5iBT 9Io3rMxp6ExYH5beL4vs6mOUa7ZIbnjr7CpFDswIWOgCy4AipzQC8O8av6MWPWtHnrg== 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=Y8mFZsgt; 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 966BB606A31C for ; Sun, 29 Nov 2026 07:43:04 +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=Y8mFZsgt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 076051F000C1; Sun, 29 Nov 2026 07:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795938184; bh=x4Ta8EUWdeQmm7+pPDE0foMnCRbcP/a+ZfaDQdy4yC8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Y8mFZsgtY94p42om4kt/ZnAbEPRAJPZvNEiuhGnwOZ4XiNVzcP393qcXTVt1xx4W8 UNV0Gd3BMblXMh57kkZWtN8PknZ5bvajCYdVLgTK5et9fvfk08GgfcdVbmGNxyxhTk xcmghV/v44UndQTARhgolTIpXuZny9GfGUtORMeu0fLjfoa95+7Pcb5tsxeo/kiarv SHZduTvX4ZPUrJ1Nzu3vBbCPsK278PxXlD33XoOEH4vCmHLASbRJ4WGIGK7DeJJmdh WnIT9SqK9OWxXb8i8tRqUOT6CD6YvRnBxi9JCjbUTyDqRLWraNEoq/amY0M41AfaGe 0L+gTSlJ4RqiQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] Input: ili210x - avoid shifting 16-bit values by 16 Reply-To: sashiko-reviews@lists.linux.dev To: "Aibing Chen" Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com In-Reply-To: <20261129073249.1622-1-chenaibing@cmss.chinamobile.com> References: <20261129073249.1622-1-chenaibing@cmss.chinamobile.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 07:43:03 +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 1 potential issue to consider: - [Medium] Input: ili210x: cast in ili251x_firmware_write_to_ic() masks u16 truncation -- commit 12e32c49e61acbe5a3e1b7031ca4d42394cc1e4b Author: Aibing Chen Input: ili210x - avoid shifting 16-bit values by 16 This commit casts 16-bit end and crc values to unsigned int before right shifting them by 16 in ili251x_firmware_write_to_ic() to silence a Smatch warning. > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscr= een/ili210x.c > index 03e4451d6393c..94e6db4d91764 100644 > --- a/drivers/input/touchscreen/ili210x.c > +++ b/drivers/input/touchscreen/ili210x.c > @@ -716,8 +716,10 @@ static int ili251x_firmware_write_to_ic(struct devic= e *dev, const u8 *fwbuf, > /* Unlock write to either AC (application) or DF (dataflash) area */ > u8 cmd_wr[10] =3D { > REG_WRITE_ENABLE, 0x5a, 0xa5, dataflash, > - (end >> 16) & 0xff, (end >> 8) & 0xff, end & 0xff, > - (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff > + ((unsigned int)end >> 16) & 0xff, > + (end >> 8) & 0xff, end & 0xff, > + ((unsigned int)crc >> 16) & 0xff, > + (crc >> 8) & 0xff, crc & 0xff > }; [Severity: Medium] Does casting end and crc to unsigned int here just mask the narrow u16 types with an expression that still unconditionally evaluates to 0? In C, u16 operands are already integer-promoted to 32-bit int before >> is evaluated, so shifting by 16 is not undefined behavior; Smatch warns because shifting a 16-bit variable right by 16 always yields 0. For crc, crc_ccitt() returns a 16-bit CRC-CCITT value, so the upper byte in cmd_wr is just a constant 0. For end, cmd_wr sends a 3-byte address and ili251x_firmware_to_buffer() explicitly allows the final 32-byte block at 0xffe0 to reach SZ_64K (0x10000): drivers/input/touchscreen/ili210x.c:ili251x_firmware_to_buffer() { ... /* The last 32 Byte firmware block can be 0xffe0 */ if (fw_addr + fw_len > SZ_64K || fw_addr > SZ_64K - 32) return ERR_PTR(-EFBIG); ... } Because end (along with df_end, ac_end, start, and fw_addr) is typed as u16 rather than u32, an end address of 0x10000 is already truncated to 0 before reaching ili251x_firmware_write_to_ic(), and ((unsigned int)end >> 16) & 0xff still always produces 0. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129073249.1622= -1-chenaibing@cmss.chinamobile.com?part=3D1