From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.135 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795943030; b=ZmghVee7OaertatNuSZsJ/sakQwlJJkiTDdTOdICeP9B9ckikLoFpiQWo6wloaN+QMbd 664h3X7hxBtP/6Hm+37eCjRACNPFqDIYiKxa4ODm3BpQvtSUxtlf8Ih3dR/WaEMTmmIE4 Jft+m60X7WuL2l28LJ2vIPDYUoXx2ZPCZZxF5OFkowZpFQZTB58dlGRnRaJRIIaoR5aDR puk4M1xFa2nYB2fMaEfyF2u+OiAmOe86zhHXHHh26kGpMsvv/kVei60B0NG+QoUrjYPt+ 4uUWe0hySjd3oACPZo9355PAbsTYREjdjjhbCoubqpz5B5CBo9zMSqfIqoVkAoPtcaw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795943030; h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received: X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From: To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=Mgr+wf3fpxLRiye3IrE/DxPzjl4mu19ZXVxLKTyOF18=; b=0lt5OfllC8Yt5ExAffdHvmaOalbPzj/FcmT00tvFPpVkW81w+QwlsFSr2zoIhQMQl0vJ NLDb9hffa+XOotsnDG5Q4pj0GxVx8t36WZucPTwt7tWzUIbG/UfUTv8cPjkDi+NFD1ukq MZbKMOe81hOS+ZOPm5xq3NtkJ4Tk+ZQG9wNhB6GwOHO+FB1MaCWF/GwMTFid4q0graZf6 YxJZ3HxvZETFCVJesRwts8RjPIRFcfOeVv7EAW4tAb2bfb3mvngizJ38opVU4xq0eA71w v0Icx/xmggl6hbym2KQVJdX4W1b+k6mUrWhf1a3JvfkqxZrUhBCYXZMH/ttbWsvWcog== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=CNz+sxnx; arc=none smtp.remote-ip=111.22.67.135 Received: from cmccmta2.chinamobile.com (cmccmta2.chinamobile.com [111.22.67.135]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 477CF606A31C; Sun, 29 Nov 2026 09:03:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 477CF606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=CNz+sxnx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmss.chinamobile.com; s=default; l=0; h=from:subject:message-id:to:cc:mime-version; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; b=CNz+sxnxkmOP1RDl87mD9tTduAUmvvXIenG8dtd0C9myxFhHb5Nhio60uaBUkDL4N1U/HPNeR2Ku3 mAlvmQY85NvN8M1Lo6UfjJMiTQfkTnl2ZiLH+7P5KdWXbaAN99/Am5Ozf6wvMubkjmwC4yYDa79LPv yVHbuGbLaBn+hg8E= X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG:00000000 Received:from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app03-12003 (RichMail) with SMTP id 2ee36b0bea6f2f0-3c84f; Sun, 29 Nov 2026 17:03:44 +0800 (CST) X-RM-TRANSID:2ee36b0bea6f2f0-3c84f X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG:00000000 Received:from FHD-W7400297 (unknown[10.55.1.70]) by rmsmtp-syy-appsvr09-12009 (RichMail) with SMTP id 2ee96b0bea6dff8-cc1c0; Sun, 29 Nov 2026 17:03:44 +0800 (CST) X-RM-TRANSID:2ee96b0bea6dff8-cc1c0 From: Aibing Chen To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Aibing Chen , sashiko-bot Subject: [PATCH] Input: ili210x - widen firmware address types to u32 Date: Sun, 29 Nov 2026 17:03:41 +0800 Message-ID: <20261129090341.1179-1-chenaibing@cmss.chinamobile.com> X-Mailer: git-send-email 2.50.1.windows.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- drivers/input/touchscreen/ili210x.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index 03e4451d6..2e4681813 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c @@ -595,7 +595,7 @@ static ssize_t ili210x_calibrate(struct device *dev, static DEVICE_ATTR(calibrate, S_IWUSR, NULL, ili210x_calibrate); static const u8 *ili251x_firmware_to_buffer(const struct firmware *fw, - u16 *ac_end, u16 *df_end) + u32 *ac_end, u32 *df_end) { const struct ihex_binrec *rec; u32 fw_addr, fw_last_addr = 0; @@ -696,14 +696,14 @@ static int ili251x_firmware_busy(struct i2c_client *client) } static int ili251x_firmware_write_to_ic(struct device *dev, const u8 *fwbuf, - u16 start, u16 end, u8 dataflash) + u32 start, u32 end, u8 dataflash) { struct i2c_client *client = to_i2c_client(dev); struct ili210x *priv = i2c_get_clientdata(client); u8 cmd_crc = REG_READ_DATA_CRC; u8 crcrb[4] = { 0 }; u8 fw_data[33]; - u16 fw_addr; + u32 fw_addr; int error; /* @@ -717,7 +717,7 @@ static int ili251x_firmware_write_to_ic(struct device *dev, const u8 *fwbuf, u8 cmd_wr[10] = { REG_WRITE_ENABLE, 0x5a, 0xa5, dataflash, (end >> 16) & 0xff, (end >> 8) & 0xff, end & 0xff, - (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff + 0x00, (crc >> 8) & 0xff, crc & 0xff }; error = i2c_master_send(client, cmd_wr, sizeof(cmd_wr)); @@ -781,7 +781,7 @@ static void ili210x_hardware_reset(struct gpio_desc *reset_gpio) } static int ili210x_do_firmware_update(struct ili210x *priv, - const u8 *fwbuf, u16 ac_end, u16 df_end) + const u8 *fwbuf, u32 ac_end, u32 df_end) { struct i2c_client *client = priv->client; struct device *dev = &client->dev; @@ -868,7 +868,7 @@ static ssize_t ili210x_firmware_update_store(struct device *dev, { struct i2c_client *client = to_i2c_client(dev); const char *fwname = ILI251X_FW_FILENAME; - u16 ac_end, df_end; + u32 ac_end, df_end; int error; const struct firmware *fw __free(firmware) = NULL; -- 2.50.1.windows.1