From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB36EC3527C for ; Mon, 7 Mar 2022 10:11:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240937AbiCGKJS (ORCPT ); Mon, 7 Mar 2022 05:09:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240227AbiCGJuq (ORCPT ); Mon, 7 Mar 2022 04:50:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7871F4E3BE; Mon, 7 Mar 2022 01:44:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F095BB80F9F; Mon, 7 Mar 2022 09:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B1BBC340E9; Mon, 7 Mar 2022 09:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646646249; bh=0tQu0CpwRLss3+hMQbOV2USPB0Dgy+d/d/xMQFVe7w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPgu/peia4vZzCumLLgXLL0q+bodBVsUBUuDxaRVs2JbyAJQI9ROrS82ijTOkoBSu Et4HgINXO5k7ejY4h6HyaUaG8TNyTozEGOBV1hODdZf4dJw46HG2vO4CKNhzH3VYMU FE4r0nOpPe6DuRnq35t6d5F+yzWRsOpOuBtQxBbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars Poeschel , Andy Shevchenko , Geert Uytterhoeven , Miguel Ojeda Subject: [PATCH 5.15 183/262] auxdisplay: lcd2s: Fix lcd2s_redefine_char() feature Date: Mon, 7 Mar 2022 10:18:47 +0100 Message-Id: <20220307091707.578968902@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091702.378509770@linuxfoundation.org> References: <20220307091702.378509770@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit 4424c35ead667ba2e8de7ab8206da66453e6f728 upstream. It seems that the lcd2s_redefine_char() has never been properly tested. The buffer is filled by DEF_CUSTOM_CHAR command followed by the character number (from 0 to 7), but immediately after that these bytes are rewritten by the decoded hex stream. Fix the index to fill the buffer after the command and number. Fixes: 8c9108d014c5 ("auxdisplay: add a driver for lcd2s character display") Cc: Lars Poeschel Signed-off-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven [fixed typo in commit message] Signed-off-by: Miguel Ojeda Signed-off-by: Greg Kroah-Hartman --- drivers/auxdisplay/lcd2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/auxdisplay/lcd2s.c +++ b/drivers/auxdisplay/lcd2s.c @@ -238,7 +238,7 @@ static int lcd2s_redefine_char(struct ch if (buf[1] > 7) return 1; - i = 0; + i = 2; shift = 0; value = 0; while (*esc && i < LCD2S_CHARACTER_SIZE + 2) {