Received: by 10.213.65.68 with SMTP id h4csp834745imn; Tue, 27 Mar 2018 09:38:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx48P8+LUZ9GEkOO4trGn+OMejDqWIov9Q8t/UU4JcJ8zVcYYBCaw8M8TtBMqaL15XWoXOqLW X-Received: by 10.101.70.8 with SMTP id v8mr37482pgq.336.1522168705952; Tue, 27 Mar 2018 09:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522168705; cv=none; d=google.com; s=arc-20160816; b=lImP0ohXRCp89uhkpjfz+EYjuc7fMpmKQ2Rv5OBgYpf+aDVRA2M9t48RLYnhQ5zjK/ L/Yojb1Oc0KU118DzzkVBtXW1npp110Ar3nUUJcyh46w1CvPNc23x4I0DTtvCtqAAIMu 5t/dJ5tfwomLuP9jRXcgic5AxtkhCOnx4VNqIlPS9YNhey7Bq1blPtcRgmpqBa7A8MIn dTlCzgyH+szgW2l9p+pxIboVp1+CTvWlufPZJ47qui8bctwUvTcjtVU+T4N1MblRjTnn /WneS/WBFp01fX6cDcuuITmdo/KOCL1XAqlAE86GIU7mjnyjYEgfBO69zZyrdyuqhJ4O PsPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KhPsUS08KnmLBtHa+jIs4vLlC8pOjhPA+Sd2WJ1nZ4Y=; b=xxKBLnnrE3y1/8xcFG3KKuSlWxA7wet81JB/LxDxoo6LT93fvHJYgJB8N/Q4UwskYn yWO2ghBKvhw3eYU8XGIn/HaYpKcvSPnmLvjEIEfpfwo9gZmvsS4dg1kZsZDKHsVzidzk sVc0EL6A2orlPViujSxCyMa1rZgG3j91zoYoiBOnrZtgvOCH5oJx2l++AcMbuiwTZPLj QRrziscMr0rwHpGtQ0HLKhylpiIdPNRgfV2u6rIwb/d8MK/I9uLZnsLZPd8LrU0H2CZF MoTgrcwTVPm9+3PWwg5/2RXvvLLhPs4gKNXuUX1bi8VN6Prp5z2sERRhhMPKdTsWJWf6 Ysqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20-v6si1645537pll.86.2018.03.27.09.38.11; Tue, 27 Mar 2018 09:38:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754873AbeC0QhN (ORCPT + 99 others); Tue, 27 Mar 2018 12:37:13 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46182 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754591AbeC0QhK (ORCPT ); Tue, 27 Mar 2018 12:37:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 100B4EFE; Tue, 27 Mar 2018 16:37:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Holderness , Linus Torvalds Subject: [PATCH 4.14 077/101] tty: vt: fix up tabstops properly Date: Tue, 27 Mar 2018 18:27:49 +0200 Message-Id: <20180327162754.810703237@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162749.993880276@linuxfoundation.org> References: <20180327162749.993880276@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Torvalds commit f1869a890cdedb92a3fab969db5d0fd982850273 upstream. Tabs on a console with long lines do not wrap properly, so correctly account for the line length when computing the tab placement location. Reported-by: James Holderness Signed-off-by: Greg Kroah-Hartman Cc: stable Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -1725,7 +1725,7 @@ static void reset_terminal(struct vc_dat default_attr(vc); update_attr(vc); - vc->vc_tab_stop[0] = 0x01010100; + vc->vc_tab_stop[0] = vc->vc_tab_stop[1] = vc->vc_tab_stop[2] = vc->vc_tab_stop[3] = @@ -1769,7 +1769,7 @@ static void do_con_trol(struct tty_struc vc->vc_pos -= (vc->vc_x << 1); while (vc->vc_x < vc->vc_cols - 1) { vc->vc_x++; - if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31))) + if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31))) break; } vc->vc_pos += (vc->vc_x << 1); @@ -1829,7 +1829,7 @@ static void do_con_trol(struct tty_struc lf(vc); return; case 'H': - vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31)); + vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31)); return; case 'Z': respond_ID(tty); @@ -2022,7 +2022,7 @@ static void do_con_trol(struct tty_struc return; case 'g': if (!vc->vc_par[0]) - vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31)); + vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31)); else if (vc->vc_par[0] == 3) { vc->vc_tab_stop[0] = vc->vc_tab_stop[1] =