Received: by 10.213.65.68 with SMTP id h4csp896242imn; Tue, 27 Mar 2018 10:45:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+oa2YK/3OIxd5fHnInIt5Op8zbkgIEZmp2/LBmuJbwX4dUUU9v4hKrBC+MIZaP7CMftA4R X-Received: by 2002:a17:902:274a:: with SMTP id j10-v6mr280808plg.28.1522172744949; Tue, 27 Mar 2018 10:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522172744; cv=none; d=google.com; s=arc-20160816; b=AXR2C9EIcM5b0G3v4CCowf0i3qDdRd0CPoAG2IzYItlnqgS1Q3hCb6NxeeEKZFNYMq bcCTdbTrzt/clgy1NP9cFcEe5RkxALKSo42QuPnk/bYZ0AB6S2kK9orD3tm/9/0L+mlY gHgQKaw6s0Zp5tbZGDEcZx52gOA9TnPHSp9jWtIePNQlrMr7rm4q9JllQVjhh8QZPBrp 5x+Fiar9CcXRIChvOCfwdywQv3IoTeNDVwVckOHH+1/9i0FcGAV++XOliu/UNzBbWR8T 8qi95lzVu19R7sSnRVC49Rn8ZpyicldsfywIIy4aH2W9D8eLBoxeP2ZBuDqIjsxGJ64J o5qQ== 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=rnHSVkc2Vek8v4g+qIQRZyZ5/QfR0DEARkrvs2qRUwQ=; b=gHiwPHHmvOYm+sf8aHuwoSFemqjFvK3lTS6vj414p6GXyvaXmT764pYkK8kgHEgjPN ZNxQBI9Y8kMJMzJ/rxhUCDadO5v/4CACShn+d+xfwjGE6fqbgrsjTK1gHt+l6H+mFVn3 p7lh2Cdwf/h3afA7PyKYtuiuRnrwzSe3rQ7AUplO7RlpAaHz95Cgy/b8bmpUem6/KaUW d4h9jVzzl3ELlw2p80EjRDI2a9jIPT2FSuaphdrXC8cvCdf2gcoB49NBp6W8IsBVwofu rldrUoPRjQomYNA/B+AiJyutdMweYgGo2P/5qKIdNIwrgNBxkNmbnj3Zok5wSDCAjhrE j+kQ== 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 y1-v6si1780855pli.586.2018.03.27.10.45.30; Tue, 27 Mar 2018 10:45:44 -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 S1753150AbeC0Ro1 (ORCPT + 99 others); Tue, 27 Mar 2018 13:44:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43886 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753950AbeC0Qd3 (ORCPT ); Tue, 27 Mar 2018 12:33:29 -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 1532F1187; Tue, 27 Mar 2018 16:33:28 +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.9 48/67] tty: vt: fix up tabstops properly Date: Tue, 27 Mar 2018 18:27:40 +0200 Message-Id: <20180327162729.950559791@linuxfoundation.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180327162726.702411083@linuxfoundation.org> References: <20180327162726.702411083@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.9-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] =