Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2283024imm; Thu, 7 Jun 2018 08:09:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL5lD1oa4bS0DqdWgHHDqKLfAJyZN8fwfARQE67k6hoqMu/cWTUFn4YDBT6xX+EwfmnX4tz X-Received: by 2002:a63:ab45:: with SMTP id k5-v6mr1907888pgp.192.1528384189874; Thu, 07 Jun 2018 08:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528384189; cv=none; d=google.com; s=arc-20160816; b=NV0hP1yH0raTyOLl0J8Q15VPFbwOGtOHSyBF2OngXYdIBcq1rT5wExYg1kx0qBUIKD MRk/7dWRqXfOBoh5PynapwtG/7BiOob93F4oK9QtrE2IGRSx0zWLa+sDkOXMQIx1A13y KlNvW6OXXh91CDIACWon7XXCtQMESiH20/NS8bpnH6wQlI99rfzfU5DgDD/2Suwmgh8f A8cQlj1OlVfL7tb1N4T12K46iXvTRBlYxgMz537u2YirTGEIU9s+HQyxEIilc6g0VxOi XcjBdZuqA/pJzDdsimXcQdMLTNMnXd5VfE2HlyFmTWGUNGrUFoGd3oTUFfUHfR7T2iNT q6fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=3W8Zm0Qb0XVcgbovQJh+PjfT1lHnsI04wFTOlg1sANA=; b=gIRBbErvNTqNaqVKW4LmXiOGcWjPE9m9F4pElTxIcE5VrEP1w1XTc15tMK2pexZizd 61HFixg0Iu7Bjjgjov+MU1aRB209/tIbnVU/mWrBjUMY8g3gaxhLbhToBARCvMymhhm5 YjqQA8dVcxETX5tzuxAAs2gOVwDOE5Iv8vQMHxUftKEj+5nbOTSdLTJ6xWHgzjjrXZhU y2dqwolqy+TAAlntJGETb/soLX95fbVyJTvIXckNGL8NgnxhIXdAc0ZnNWIGA7Q41lFA a09eRrn6pXwg7lOBnDiF2ZKJqvqPn/8qa2leoya7d+FxGmwXmI/jWJyhJpFHcr7rlI8j lFAw== 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 v1-v6si1843916ply.458.2018.06.07.08.09.35; Thu, 07 Jun 2018 08:09:49 -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 S935953AbeFGPDn (ORCPT + 99 others); Thu, 7 Jun 2018 11:03:43 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41518 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935924AbeFGPDi (ORCPT ); Thu, 7 Jun 2018 11:03:38 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbJ-0005a0-9I; Thu, 07 Jun 2018 15:09:17 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbF-0003Im-4q; Thu, 07 Jun 2018 15:09:13 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Linus Torvalds" , "James Holderness" , "Greg Kroah-Hartman" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 396/410] tty: vt: fix up tabstops properly In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 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 Signed-off-by: Linus Torvalds Signed-off-by: Ben Hutchings --- 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 @@ -1705,7 +1705,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] = @@ -1748,7 +1748,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); @@ -1808,7 +1808,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); @@ -2001,7 +2001,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] =