Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3540758imu; Fri, 30 Nov 2018 01:57:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/UH0HLhKrInXDun/I3ttX1uxGlZ2+twJ+YgkE5nbjGUgZQc1AUDyh/AnDsRL3iIDIRIsEkF X-Received: by 2002:a17:902:a9c4:: with SMTP id b4mr5057895plr.298.1543571861022; Fri, 30 Nov 2018 01:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543571860; cv=none; d=google.com; s=arc-20160816; b=zt5aTieytpDg5AQ4A8MQsizkFuzxpR+bZimggcFlbDGiPv8NPtdOZhKHM2bSe31yqU 4tqAvyQld1gnERo4NsABHoal/2uaMlK9Hk59kONdKKL0Vrbk1XVO/O0XQVmlXwk3RoCH eKajD1tVaXYyD33KVAdySHiqUzHwbZK4Xx7NJs669CRmsJiJWpW2j0CfB8i+wTUJ2JBh f4O6TZH5biOcmSr0O0oxiHyoRGv/vaOIvzW5cV1TAEBeAda+YBv50AZKP8H8GRalydsu YWLStj2ONoqK7SjsrBoas3q3msPezFEe/h826T2sUs5Z/ySuMUSnmrRh+PUDDc+Ox/xf Ezcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=nrJFYSkFD8YLWVkFWkaDxbTzFz5zPmYiFsPAfHs79KE=; b=w2mVh8gUpvBge0a3+h1RLHMbBBHzumWMDtsrC0N4LNokcDCLilv3L4twMiMbqiACgw R69Itx/n2zOioIo3MfGm0HnuUiBbZdRwNFbxNi2yoZEfOg7fpK+neLmnxt8gOR2V5Ew2 HxSn6664+w+/qPqGheHiSCtfN/u+Osb6ih2XxqKrdS3H4p4L6WFyx4/+9fr14kPNvZE1 ZXzaU3LrH1pMUXgkyd4OywbGGfH1T09yPF8fj9H96GV0qIapV4WY1btvU3fszC8csqXh +tD554xxTfCf04g6GaqlVW+PImsvTMrn6QlMSaY1Nf+heZi+yNyzuKp/dFO7VANIlqX8 FjcA== 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 x186si4459992pgb.33.2018.11.30.01.57.26; Fri, 30 Nov 2018 01:57:40 -0800 (PST) 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 S1727221AbeK3VF0 (ORCPT + 99 others); Fri, 30 Nov 2018 16:05:26 -0500 Received: from terminus.zytor.com ([198.137.202.136]:33283 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726582AbeK3VF0 (ORCPT ); Fri, 30 Nov 2018 16:05:26 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id wAU9thnd3260962 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 30 Nov 2018 01:55:43 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id wAU9tgX53260958; Fri, 30 Nov 2018 01:55:42 -0800 Date: Fri, 30 Nov 2018 01:55:42 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for YiFei Zhu Message-ID: Cc: natechancellor@gmail.com, mingo@kernel.org, hpa@zytor.com, hdegoede@redhat.com, marc.zyngier@arm.com, dave.hansen@intel.com, bhsharma@redhat.com, zhuyifei1999@gmail.com, linux-kernel@vger.kernel.org, sai.praneeth.prakhya@intel.com, matt@codeblueprint.co.uk, peterz@infradead.org, jonathanh@nvidia.com, torvalds@linux-foundation.org, eric.snowberg@oracle.com, bp@alien8.de, luto@kernel.org, julien.thierry@arm.com, ard.biesheuvel@linaro.org, sedat.dilek@gmail.com, joe@perches.com, arend.vanspriel@broadcom.com, tglx@linutronix.de Reply-To: sai.praneeth.prakhya@intel.com, linux-kernel@vger.kernel.org, jonathanh@nvidia.com, peterz@infradead.org, matt@codeblueprint.co.uk, torvalds@linux-foundation.org, natechancellor@gmail.com, hpa@zytor.com, mingo@kernel.org, hdegoede@redhat.com, marc.zyngier@arm.com, dave.hansen@intel.com, bhsharma@redhat.com, zhuyifei1999@gmail.com, luto@kernel.org, julien.thierry@arm.com, ard.biesheuvel@linaro.org, joe@perches.com, arend.vanspriel@broadcom.com, sedat.dilek@gmail.com, tglx@linutronix.de, eric.snowberg@oracle.com, bp@alien8.de In-Reply-To: <20181129171230.18699-12-ard.biesheuvel@linaro.org> References: <20181129171230.18699-12-ard.biesheuvel@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] x86/earlyprintk/efi: Fix infinite loop on some screen widths Git-Commit-ID: 79c2206d369b87b19ac29cb47601059b6bf5c291 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=1.6 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_48_96,FREEMAIL_FORGED_REPLYTO, FREEMAIL_REPLYTO_END_DIGIT autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 79c2206d369b87b19ac29cb47601059b6bf5c291 Gitweb: https://git.kernel.org/tip/79c2206d369b87b19ac29cb47601059b6bf5c291 Author: YiFei Zhu AuthorDate: Thu, 29 Nov 2018 18:12:30 +0100 Committer: Ingo Molnar CommitDate: Fri, 30 Nov 2018 09:05:13 +0100 x86/earlyprintk/efi: Fix infinite loop on some screen widths An affected screen resolution is 1366 x 768, which width is not divisible by 8, the default font width. On such screens, when longer lines are earlyprintk'ed, overflow-to-next-line can never trigger, due to the left-most x-coordinate of the next character always less than the screen width. Earlyprintk will infinite loop in trying to print the rest of the string but unable to, due to the line being full. This patch makes the trigger consider the right-most x-coordinate, instead of left-most, as the value to compare against the screen width threshold. Signed-off-by: YiFei Zhu Signed-off-by: Ard Biesheuvel Cc: Andy Lutomirski Cc: Arend van Spriel Cc: Bhupesh Sharma Cc: Borislav Petkov Cc: Dave Hansen Cc: Eric Snowberg Cc: Hans de Goede Cc: Joe Perches Cc: Jon Hunter Cc: Julien Thierry Cc: Linus Torvalds Cc: Marc Zyngier Cc: Matt Fleming Cc: Nathan Chancellor Cc: Peter Zijlstra Cc: Sai Praneeth Prakhya Cc: Sedat Dilek Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20181129171230.18699-12-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar --- arch/x86/platform/efi/early_printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/platform/efi/early_printk.c b/arch/x86/platform/efi/early_printk.c index 7476b3b097e1..7138bc7a265c 100644 --- a/arch/x86/platform/efi/early_printk.c +++ b/arch/x86/platform/efi/early_printk.c @@ -183,7 +183,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num) num--; } - if (efi_x >= si->lfb_width) { + if (efi_x + font->width > si->lfb_width) { efi_x = 0; efi_y += font->height; }