Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp103996ybl; Tue, 7 Jan 2020 15:05:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzQbnpoV+mQlrJUenr+MMPDQG1ny/zKkEGYPwGVvOol5L96hF49DlqdI8spX2YXgeE+oyzR X-Received: by 2002:a05:6808:618:: with SMTP id y24mr682515oih.86.1578438307436; Tue, 07 Jan 2020 15:05:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578438307; cv=none; d=google.com; s=arc-20160816; b=BnOcllbKMCXzYjrTZai2wL42sP/fmhRZqOW/xDdZ7/pTu353EDor9/dV1TXHH9ljI6 wvd95R3ah6KSV5/rgyetrBbRJKvBEJbpT4StdiJvdwnbD6mtcK8o6hI0G/8/9RPbyLil Usr4bLOO/QGbKPw/oicjZY0Smkagfz5lT5FYZx+JoS4TecpyzcoPByd+BmCXisHa9xk5 eMjC+qm+geiPhLvL9oAPao4peteQPMWJ/1JW/pDpWe6Tj1BNf0sdS9lvo2rVlxFLjrlR TuatLXGXrvppP3btF6WZ7Kh3wcp78sSpX/GHSoIASjS2tf/jx862LLzwZHroQEb3eHQ6 IrNw== 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 :message-id:date:subject:cc:to:from; bh=Bs8NMK22XFYTZSerY7vskoSjOxNnBJD2Ihu3wEWVhiM=; b=HeVcMNJlsTO/bGvO8RZ6RiV2JV8XNYDqPgSA4BVCC4yQhC2LZMKFuM7KwimT9p/NkA D7VB34xRm1mWA/78QfRxOupeCJpKZxsaVo2ylngCz7dtehAwo3tFAHw78sj5b+NcnzDt PXM45N5imHFSraBKFHWMHZyChp5XNVJw/Bh7QM27clrORZu8J0yVmiZ/aq0PYVdLypNN LjCa9uOUBamKiT+jvxys1cZALtS+ZVM5GYmhw48e3XF2gFLscVAyaRcgAFg53Ag6Dr97 pRhhkvRz+2KOKw3WYi38mmsZ0s/3A4WIyjJVdPMGLdnzTJJOPxia1Gy0cmetKn3MmuHf z+Eg== 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 t20si667038otr.64.2020.01.07.15.04.55; Tue, 07 Jan 2020 15:05:07 -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 S1727311AbgAGXEM (ORCPT + 99 others); Tue, 7 Jan 2020 18:04:12 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42557 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727077AbgAGXEM (ORCPT ); Tue, 7 Jan 2020 18:04:12 -0500 Received: by mail-qt1-f196.google.com with SMTP id j5so1207500qtq.9 for ; Tue, 07 Jan 2020 15:04:11 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=Bs8NMK22XFYTZSerY7vskoSjOxNnBJD2Ihu3wEWVhiM=; b=KHSzv6OcnM/lD9cXjfh1QY6Utyr6U+BewTRmitfCAKu9tmhVaXaTm1UonO7xOOV3db s5IMztrbLGEDSq3uKqXqD7e8NTqay07L5LfGHBTAvCd+n2onFJOHpGrG3siJfuqEzM3X ttpP+UTjLnRaWQVtd7ZGLrWCElGEbLI8dh1WEhTkxIsCbgqDkzuqk9J1jDABJ2XGuGl5 SUycf9na5D50X1sJNy1r+XUJoG3DbusmGtV4V1tvCQFCpD3NUPub0K7gdrAJx2QRRknq JtgzcFhIzLeWar1kF9DWie1G8h65Hpow+e04Ut+xIT5L+m70NO8WbA85FDaqcz6F11hr GZeg== X-Gm-Message-State: APjAAAW0hg2OoK5CzHACKSHtTewqMb7cEBKk7ZjeTqbvxAmK3AVFvXwA nQjLd6wOQi/o253Iy6RUk5M= X-Received: by 2002:ac8:4a11:: with SMTP id x17mr1217967qtq.226.1578438251469; Tue, 07 Jan 2020 15:04:11 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id k184sm568617qke.2.2020.01.07.15.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 15:04:10 -0800 (PST) From: Arvind Sankar To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Christopher Head Subject: [PATCH] x86/sysfb: Fix check for bad VRAM size Date: Tue, 7 Jan 2020 18:04:10 -0500 Message-Id: <20200107230410.2291947-1-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.24.1 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 When checking whether the reported lfb_size makes sense, we PAGE_ALIGN height * stride before seeing whether it exceeds the reported size. This doesn't work if height * stride is not an exact number of pages. For example, as reported in kernel bugzilla linked, an 800x600x32 EFI framebuffer gets skipped because of this. Move the PAGE_ALIGN to after the check vs size. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206051 Signed-off-by: Arvind Sankar --- arch/x86/kernel/sysfb_simplefb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/sysfb_simplefb.c b/arch/x86/kernel/sysfb_simplefb.c index 01f0e2263b86..298fc1edd9c9 100644 --- a/arch/x86/kernel/sysfb_simplefb.c +++ b/arch/x86/kernel/sysfb_simplefb.c @@ -90,11 +90,11 @@ __init int create_simplefb(const struct screen_info *si, if (si->orig_video_isVGA == VIDEO_TYPE_VLFB) size <<= 16; length = mode->height * mode->stride; - length = PAGE_ALIGN(length); if (length > size) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); return -EINVAL; } + length = PAGE_ALIGN(length); /* setup IORESOURCE_MEM as framebuffer memory */ memset(&res, 0, sizeof(res)); -- 2.24.1