Received: by 10.213.65.68 with SMTP id h4csp913585imn; Tue, 27 Mar 2018 11:05:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx48r1UNt+Wej83PPcdI0swDD2hdPMQYGBRmiTnN0/qIERvK6bjA5cVPgAJUmBYeeZaza4oA/ X-Received: by 10.101.97.15 with SMTP id z15mr195628pgu.393.1522173922536; Tue, 27 Mar 2018 11:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522173922; cv=none; d=google.com; s=arc-20160816; b=IPyY9QE4HtSQfo43uadz/1TIy3b2fyHEr9MdxxMd5WiZUnvLH9/tfsfrGkhMb/+ycr mQXrvmlWTupa1eM2qgsmI5ymYQGMhSnpHev58hUBxiNeWwG1vxY3nhdpDFkVsNaTAGVf l4q9S8CQOjJA0oRvpxHCzHyEFDQAI/D4bZt9yTE1Ves74wOljYWB8meiH5obzVyk88Zl aWMtwevh1BlRI3hATP1fb+h0gco3IKJcQOBHBmyUJGJRRNgEgInTKy9zgo5SDXzUnouB 9kFoR8FIZtoCO+33yZoZwyDjz1DODcvxst8Ao2jdsqnxkxXBVEJJk2GsP11oAP206aw9 vL7A== 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=NVRbf7KP6juD3Tn4b8Yn+b5AhBQIlf6wxHfWIc6yNFA=; b=lCoKm7OF9gJ+u9qCaj7p/Fxh1sUrx4ZWkSos8YWJnJ/QcvlxC43ug1XFhGkniuS47/ 6hSbF/YBC5mLS3PMhvf7dS8fklQxP3zaDFtJW6yeFmvgFxP+uR0CR53rxrk4QkQ8/rSb 3ixa0oNKy9h/lVCr2E9XxnLcSKZmaiZC7GzLRRLOMfwuvB7YxQZQ5Jx2LzqPX9p6vvJD oVPbrH9eDTopNwQVvpQ0WQNzbY+VcRRMW1Gi8xtjhwM2S7nTSFEtO/56HTAxn/ZcWux+ cSXjdHmwfICimM0Xn63cwj5duHcTy1Vs2it9rRkIdG/li90dhKyYzDlz3Cfcc5+pi09V 5xaQ== 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 j11-v6si1532748plt.266.2018.03.27.11.05.07; Tue, 27 Mar 2018 11:05:22 -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 S1750800AbeC0SDw (ORCPT + 99 others); Tue, 27 Mar 2018 14:03:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41490 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752788AbeC0Q3u (ORCPT ); Tue, 27 Mar 2018 12:29:50 -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 9379D1107; Tue, 27 Mar 2018 16:29:49 +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.4 34/43] tty: vt: fix up tabstops properly Date: Tue, 27 Mar 2018 18:27:38 +0200 Message-Id: <20180327162718.327885560@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162716.407986916@linuxfoundation.org> References: <20180327162716.407986916@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.4-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] =