Received: by 10.213.65.68 with SMTP id h4csp839925imn; Tue, 27 Mar 2018 09:44:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx48UDuQ57HELI5tIjOQ4BHkZfTPJxdB4tJrZTFsMjqMTnhr7SW05HYtmAhn1CTha+Pg5QRtg X-Received: by 10.98.87.7 with SMTP id l7mr69653pfb.148.1522169080339; Tue, 27 Mar 2018 09:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522169080; cv=none; d=google.com; s=arc-20160816; b=ncA0LM2cYdSxsClor893T4w55gEg3K8L47QQAT1AITkM5jNYnw+B+jCzBj5ySVHQCd Wsy/P1lIhDY38awq/FZNpfLoSEs7kJnt8Qke6qduZ002R9dWukFqD2ZjODU2SyVLyZJB 5Kb+oFKgyN0mT5rLkNZQIKkd8t4RkOeTJ3jEdO0ZLyvi+8PWuyUNeHRjU0XdWeLtIK/O 9jOrkEa/URA/Sqolg2B1DT4+B3l6/OGYaf/ytNH74hPTNWzCVwMVDtvPO6h9WdWSIMmw f5RQ3c4WUtmghy/ojJcnqFyCQ3RfLwUT81pFc77PbUeVvq+RZ6Hkxw7xIl50qWonoKvX 5kng== 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=AYgwGhos/HhMRwiVglsW7xamwJRYQXYWSOK6sUuxhT0=; b=H3wr1gudN49lq7JRZ8BHlesceCPr4deCE1tMU/XcFB322ALAjLf/qXINdhLnusT/m2 grWVj25GDUoq/8Jy42TyoGCi+anAogKaa46hyoUx6e8RRUW7VDPFHoygwxGojtUjhlKx col67RVJBwxyulbdVQORHqGLHHpfMhPbqLC80+XhQyNLif1D0ZT3GBneRTb4Tiej5S/4 BT8sUgutTTCGkto1RWPXajewvKAtDm0ZH9BgmFCy3rnj7v9cyLPGl5VrTPij0WyHwRTD TMHCOqozYDiotz7XzIiR+yfaYjSS5LxwJo02+mSWZpxYbxiUsMLpFZTTwvxnr9vBT10E BO+w== 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 r15-v6si1743842plj.96.2018.03.27.09.44.25; Tue, 27 Mar 2018 09:44:40 -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 S932665AbeC0QmI (ORCPT + 99 others); Tue, 27 Mar 2018 12:42:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48916 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932631AbeC0QmF (ORCPT ); Tue, 27 Mar 2018 12:42:05 -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 A1636F77; Tue, 27 Mar 2018 16:42:04 +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.15 082/105] tty: vt: fix up tabstops properly Date: Tue, 27 Mar 2018 18:28:02 +0200 Message-Id: <20180327162803.352968439@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162757.813009222@linuxfoundation.org> References: <20180327162757.813009222@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.15-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 @@ -1727,7 +1727,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] = @@ -1771,7 +1771,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); @@ -1831,7 +1831,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); @@ -2024,7 +2024,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] =