Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6466520ybl; Wed, 15 Jan 2020 05:13:41 -0800 (PST) X-Google-Smtp-Source: APXvYqw1tvbbrEGkESXg9QR5VEcm9j4ZQ55hI2hevmmZ7rRaNxSsrmN+h6q0mB8as1hAHQd41AKU X-Received: by 2002:aca:53c6:: with SMTP id h189mr21341783oib.11.1579094021562; Wed, 15 Jan 2020 05:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579094021; cv=none; d=google.com; s=arc-20160816; b=RqmNKPDR5cbqBcjv8ei4sjv/XU5WrZv4/8UvwpMnAJG9JLpUIxvz/kWYeQGSKENDw/ y02eAZbU32HIcuS684u0CfpYLoNC5vIPvgHVW+NPDTnLDlfPKZTHeW6kbUsI/GSNmZDJ 6LExMZysH/Iz3I1meN6md3u1XiCgkiFNgEaRLWBmUGv+NlBSja9QcmpdgADUV+ry2Jzp 5Ifo7g5I4+n2wCyliSGbJAnbGAFiDQbX0ZA1buLISr3wZAFDdM27/xySgxayyvZVwNKz IBGvhu+VOJ51yFJPRqSI0t88IvfxNb7R5v2RAkwdc7Djj9pZ8b5yl9awYv8yMdUaf0dh 56hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=f+uFY3ywa7zVMTIIWGNJsEI8zxzucRmE9+gtjYc9q8M=; b=dUGGmnDyJDY2UNrQSiObfbaCNDtKKPf6wGHYRvybB+/gP2/fSKbKfmvIv2OEc3FclO 37R2p7vHZnt2DoS8Cf+8QodKbGuwKz8IdiaA7AfsAtLLje5Ynn505MYpEd/O+9Zq7vEo Tscg+61m6DC3gjJeQJndXZCEiCBEKsRzZRPyJqs+QYVqDWQl9babSYamzwsATF7v6F8W Smt93up/R+hOzx9ZtNKaZLceMaGgdMWj6UWLhIUeUnDt3y6jngggBvskUuvcjW1Lxy5A IlxmoJuB+I8DEiivbfxOk84A9+Of2arXzhC0pUr9fZ1up4GcjvFgPiowvRT73Cr21nrw 1YLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=LQY5WOLf; 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=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si9035046oia.165.2020.01.15.05.13.28; Wed, 15 Jan 2020 05:13:41 -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=@alien8.de header.s=dkim header.b=LQY5WOLf; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbgAONMQ (ORCPT + 99 others); Wed, 15 Jan 2020 08:12:16 -0500 Received: from mail.skyhub.de ([5.9.137.197]:50636 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbgAONMP (ORCPT ); Wed, 15 Jan 2020 08:12:15 -0500 Received: from zn.tnic (p200300EC2F0C7700ACD7CA379FB916C9.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:7700:acd7:ca37:9fb9:16c9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id B4C1E1EC02D2; Wed, 15 Jan 2020 14:12:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1579093934; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=f+uFY3ywa7zVMTIIWGNJsEI8zxzucRmE9+gtjYc9q8M=; b=LQY5WOLfbsvB2Wb3gIJ0lAUmKJANeqpwVYNiwTmVFMzpyDlvqKg4qpX4Zd5yTwjztEqPHZ 2bnE05F5rQCwAtqIXkvIs1xB34ct5QkbS0jLtJ2m/VzP1i0/k5ltrSYzOg6Yj+1plXUhGq KZfuFdf/FdxVX6NxlsdUne8OfWES7ho= Date: Wed, 15 Jan 2020 14:12:06 +0100 From: Borislav Petkov To: Christopher Head Cc: Arvind Sankar , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/sysfb: Fix check for bad VRAM size Message-ID: <20200115131206.GF20975@zn.tnic> References: <20200107230410.2291947-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200107230410.2291947-1-nivedita@alum.mit.edu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 07, 2020 at 06:04:10PM -0500, Arvind Sankar wrote: > 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)); > -- Christopher, can I add your Reported-by: and Tested-by: tags to the patch? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette