Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2724659imu; Thu, 29 Nov 2018 09:15:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/XE+m35X2DuLa3ZpyUusSI7DMezONs9RBD33UPIdwrpBuSMpF01iMJ9zvB54GtHjVypEeBj X-Received: by 2002:a63:ba48:: with SMTP id l8mr1908994pgu.72.1543511702622; Thu, 29 Nov 2018 09:15:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543511702; cv=none; d=google.com; s=arc-20160816; b=v4Zf+yibegM0Vc7N6TPoTsgJpvKVtDqsovyJ1ySNSTorSajDGX/JB8Ox/WqS3gZAJJ Sc01YZnhyhs2Dtesc8pQ8IkiI0RjhdrZeBwISfLReOA3szC8Fdj6Ke/D4puVb6M1S0eb USY+6O/fNYadZHqjid2dpCbOWmM8KtkCQk12rhtJ1XfY3wri9KiLlN5iFrNO/UDAm2kC bguaxXIfa59OlsG2hPGE0bc3TZeaRaLorL+HkBrjHLf32IbOjMm4KrXIzkHuRRVzBi2B W1jGDaaOloOufoo/RnSyZyC9GF9Y6aAeAlh/33/3zYwD42EwXSh2k2u4xc/uLl9n3GyA V9wA== 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 127si2817851pfg.173.2018.11.29.09.14.09; Thu, 29 Nov 2018 09:15:02 -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 S1730682AbeK3ETM (ORCPT + 99 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 Content-Transfer-Encoding: 8bit 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(-) 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; } -- 2.19.1