From patchwork Thu Nov 29 17:12:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152421 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2634318ljp; Thu, 29 Nov 2018 09:13:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/UJH+A8H33ta0+tqcYMPG2P6f/5Q0nzsxIVzm+MW8wfHx9pJWPiSP+Wr758qGT15QGaJ7A5 X-Received: by 2002:a62:6ec8:: with SMTP id j191mr2186355pfc.198.1543511590392; Thu, 29 Nov 2018 09:13:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543511590; cv=none; d=google.com; s=arc-20160816; b=cpPf1wk+NDue0RPj3h86anE+YY5hBkgurjuLtURhFFnhKV4RNFMeDzMwjYchU8Pd5n Xy87uI++L055SLmcbjB4ZQy07KmYl8+TB1c0P133f1sMKWhpQ7fM18V5g/jBcfnvc8au PaBcJQSRMoi2rrkrdgChomgnA9I1wRJgOtfW/VYIShflLMRpDx4F7Doj9bOz/wbm60m/ hi4LYiG6SMyhD5ziZ3XPXrHzcN0o/mvwOiDaMnZ/IhapJK2vVXpBVBhf5jVqxbKsPshl JYWLL4oMsmc/COXqNarfiKIg73AqyuYnokx0njY0WltdsiQo79Ipwm/IUBtMsS/tbCVE 6fYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B3Orb74WwT6irLdvQjoh7i+GpPzyw+FEcB0oGPiZXlw=; b=lvBuFzO+wSY9m5rwNcDmIpLd5bQyli57+3uPHWeLPy00x4Tpbi3buzVHgrbiex53pH mCdh6ZudNAdPuLOdeqlZzn4Hh6NUdT2prNWgkcBSAhq66oQD6JsPAd/8AoSN6Ov7NX68 lbNKddWJrMO1qfsu6FKfQoqCHK7axxIe+sxkdGC/JwzmO7L8GsowHxyw2+eGx6PyGIin TbTBXPjIvh88Q3Z4fIS+ZP+I4+6O8V8JEj46WsiUGOgrtFsch1qw8Ae0HA4GdahBcJMG PAqnWcPagbDsymsI/JTGkulk/bbMed0mVAdcoy3SoPemAbyq+UtIcdRF/H4bbxcMux5s GKvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O+euQ7cO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si2538523plp.137.2018.11.29.09.13.10; Thu, 29 Nov 2018 09:13:10 -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; dkim=pass header.i=@linaro.org header.s=google header.b=O+euQ7cO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730687AbeK3ETM (ORCPT + 32 others); Thu, 29 Nov 2018 23:19:12 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41339 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728551AbeK3ETL (ORCPT ); Thu, 29 Nov 2018 23:19:11 -0500 Received: by mail-wr1-f66.google.com with SMTP id x10so2665592wrs.8 for ; Thu, 29 Nov 2018 09:13:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B3Orb74WwT6irLdvQjoh7i+GpPzyw+FEcB0oGPiZXlw=; b=O+euQ7cOPUSvTs0X63EO/sOSn7bDdrMGZJ5nE1modkea/IlEoTYp6VkHHZtZa/61aA B+VBxGQZ6y/i+q9i6B3V5aJqNEin4OkrJAnfp7SShnyPgSmw4KBttr4E/6qg8f0uY/Kq mPFOiayoNqoeagrCpxVdR1sjiUWaJgacNx0mA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B3Orb74WwT6irLdvQjoh7i+GpPzyw+FEcB0oGPiZXlw=; b=Aq25pkAYql6XfUaboU8DrDEv1dVlzBZ6Fo1inTYHiAJB7BkLNTz8kaaOheyTMtpEFR uyZ8/KRS8mI7Dv56Tc0k1qCptdRiqS3xLN9Y4ho8fzGu1Z6lNoln0pQBCCACk0s3d2zU pFZdpIqSJERcIC7bU8tttHUhqq0qQ975of9YNPKSSwLzr0efFVb63Etzm6eUJXMV5gs/ n5R8EZVUKbEU4g7b8OVt/Ba80AZ8cqE2cApcGHFDu+eYwZNSI2ITgL6BhZ4Y+LU6hTrK 6YRaqYBSrU/xjkH93fOBUAUXuKaelDj0HkIKLSslAL6yFhqoMhOcxRFGYP0OLZfBVrEC KBWg== X-Gm-Message-State: AA+aEWbFElPFttcdDKYKvVnfBjsZbIZa+Kr98YutbygD5BmbdWP3ontO MS4ygdA9Vkff+OwctXTM6lLKgg== X-Received: by 2002:adf:8228:: with SMTP id 37mr2092166wrb.160.1543511585964; Thu, 29 Nov 2018 09:13:05 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:f070:d240:312e:9f99]) by smtp.gmail.com with ESMTPSA id y185sm1593882wmg.34.2018.11.29.09.13.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 09:13:05 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Lutomirski , Arend van Spriel , Bhupesh Sharma , Borislav Petkov , Dave Hansen , Eric Snowberg , Hans de Goede , Joe Perches , Jon Hunter , Julien Thierry , Marc Zyngier , Nathan Chancellor , Peter Zijlstra , Sai Praneeth Prakhya , Sedat Dilek , YiFei Zhu Subject: [PATCH 11/11] efi/x86: earlyprintk - Fix infinite loop on some screen widths Date: Thu, 29 Nov 2018 18:12:30 +0100 Message-Id: <20181129171230.18699-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181129171230.18699-1-ard.biesheuvel@linaro.org> References: <20181129171230.18699-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: YiFei Zhu 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 --- arch/x86/platform/efi/early_printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.1 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; }