From mboxrd@z Thu Jan 1 00:00:00 1970 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 B8CC93B47DF; Tue, 21 Jul 2026 20:47:22 +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=1784666846; cv=none; b=eJBTcVaD4arXic0d80I/p5MNcerjvIu+Le7dp6fU0DnAcP0JdSSg7dQbl4R8n35W9ecKc+6P6DLWTmt4gzWCOwi1PdXvPljqjPAuzdSxLfYWI2CMd43noSSGlfFeqf7FyzFAezf3RSzJf314SNuQhhrD/yidOmniiGygOaQiu/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784666846; c=relaxed/simple; bh=qyXFO1yJKqER/5pW52ZrV2NUH3SFg5f0MWUZTETSugg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OGQDz7HQOrWagkH8n5+w/EPOEQyHeL5hUgHlkB9ycFor0NSuDT1uAW+wV1LkFUSwT2o0OAizwkzAD2C3HAPi7uyrEjhEXzo8DvjtuiRHnT8MJ3gNnNnRcoqHwmi235nwI5/Ov0WfgE6LY9q5tX4zX6IjiLcl8Q5KU14bkgmGCkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mI2dm997; 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="mI2dm997" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 222301F000E9; Tue, 21 Jul 2026 20:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784666842; bh=7GLa3L6yn8nRhmOOUdLQAhicuJtY0CgOWB+IYuvjy44=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mI2dm997LG3+gRQ0fACHT5m6XVIlfxVG25ARKxFZrThLFpY91odXohBDu/s3LuMqQ Rcfhb7uw5oVZsLRY8elT0lyrpNyTb3w+lKrDjxatJRSpqAHB5iS5I7ovBaGRjnjrMV 09xHSu6yqwg+HBm80UEc0FAgVlJfiBlbIzRmcRaY= 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.6 0837/1266] HID: picolcd: prevent NULL pointer dereference in picolcd_send_and_wait() Date: Tue, 21 Jul 2026 17:21:14 +0200 Message-ID: <20260721152500.583331672@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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.6-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 bbda231a7ce303..ee0977a8e42e0d 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