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 8F40346EC78; Tue, 21 Jul 2026 18:22:12 +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=1784658134; cv=none; b=IkQ5vlSMXP8Abm7Kl7bnxqWS5UY13iKJI0xPQJymvvKKmwzwEfEdbpdWvrDVozyPF5vyrZqXvCahYrC8oA+HMJsZMDY09nII1OsFjnpYSvuw/mPEP0m1wesKkWs6BQs4yV9Co06vvbXd3p3KIwCf8F6TCuJPGNtIRTWXjPgxvQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658134; c=relaxed/simple; bh=7u4wC8kmoy+AFLXudIGIT8lZjfNCVL7fv62N+XBH7RA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qnRh8MK3cWFRKcLmJI4tKtKxTTSvkVN9zYcSPDOkv3U+TRZZOSZ7piBAdVr8/43rsWM7lgHE00Qiq0j75BGrjSNfAQq6vx3UyCpxyGwH+z7rH2U2q8zhSlQ/IsgkjbbTncASaeCmvjyfoBkXFMAwJTD1t1q7AjE9fgZMJrWydH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=uAWPbd3p; 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="uAWPbd3p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 009AA1F00A3A; Tue, 21 Jul 2026 18:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784658132; bh=qObtmyOMEgkZDUVxJkdeZMkGBzQ4gzV53hmh8HClJI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uAWPbd3pSoXqNRz6WLy7yjy5iN1bjsIl7U2qPBDKm9QxCB++yUTP2m7c9G1vvKhg3 4a5PQ2G/HR/HZA6MxZeRUZXlItu1g23sS72yeIfGIIpri+9j1EVW+LHszPwC6tzZxe w6PQK7r623pJXC2cuMfs8D8ehI8vk6vd/rz/W1Ug= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Georgiy Osokin , Jiri Kosina , Sasha Levin Subject: [PATCH 6.18 1029/1611] HID: picolcd: prevent NULL pointer dereference in picolcd_send_and_wait() Date: Tue, 21 Jul 2026 17:19:05 +0200 Message-ID: <20260721152538.544319425@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Georgiy Osokin [ Upstream commit 0021eb09041f021c079be1022934a280f7f176c0 ] In picolcd_send_and_wait(), an integer overflow of the signed loop counter 'k' can theoretically lead to a NULL pointer dereference of 'raw_data'. If the loop executes more than INT_MAX times, 'k' becomes negative, making the condition 'k < size' true even when 'size' is 0. Change the type of 'k' to 'unsigned int' to prevent the overflow and eliminate the out-of-bounds access. Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. [jkosina@suse.com: extended hash length] Fixes: fabdbf2fd22fa17 ("HID: picoLCD: split driver code") Signed-off-by: Georgiy Osokin Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-picolcd_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c index 297103be338157..282f11ec5df741 100644 --- a/drivers/hid/hid-picolcd_core.c +++ b/drivers/hid/hid-picolcd_core.c @@ -72,7 +72,8 @@ struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev, struct picolcd_pending *work; struct hid_report *report = picolcd_out_report(report_id, hdev); unsigned long flags; - int i, j, k; + int i, j; + unsigned int k; if (!report || !data) return NULL; -- 2.53.0