All of lore.kernel.org
 help / color / mirror / Atom feed
From: josh@joshtriplett.org
To: Matt Fleming <matt@console-pimps.org>
Cc: Matt Fleming <matt.fleming@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-efi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Srihari Vijayaraghavan <linux.bug.reporting@gmail.com>
Subject: Re: [PATCH] efi-bgrt: Add error handling; inform the user when ignoring the BGRT
Date: Thu, 31 Jul 2014 09:11:33 -0700	[thread overview]
Message-ID: <20140731161133.GA12663@cloud> (raw)
In-Reply-To: <20140731103110.GC15082@console-pimps.org>

On Thu, Jul 31, 2014 at 11:31:10AM +0100, Matt Fleming wrote:
> On Wed, 30 Jul, at 12:23:32PM, Josh Triplett wrote:
> > @@ -61,14 +81,18 @@ void __init efi_bgrt_init(void)
> >  		early_iounmap(image, sizeof(bmp_header));
> >  	bgrt_image_size = bmp_header.size;
> >  
> > -	bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL);
> > -	if (!bgrt_image)
> > +	bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
> > +	if (!bgrt_image) {
> > +		pr_err("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n",
> > +		       bgrt_image_size);
> >  		return;
> 
> I'm not sure that using __GFP_NOWARN is the right thing to do here. If
> for some reason we can't handle the BGRT image we should include checks
> in the BGRT code, rather than relying on the page-allocation machinery
> to save us.
> 
> Let's just use an explicit limit on the size of the BGRT image we're
> willing to handle.

I started to add an explicit limit, but any reasonable limit (large
enough for modern screens) would be large enough that there's still a
non-trivial possibility of allocation failure.  And I think it makes
sense for BGRT image allocation to be non-fatal and minimally noisy
(just a single-line error, not a scary-looking allocation warning),
considering the highly optional and cosmetic nature of BGRT.  So, I
believe __GFP_NOWARN makes sense.

- Josh Triplett

  reply	other threads:[~2014-07-31 16:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30 19:23 [PATCH] efi-bgrt: Add error handling; inform the user when ignoring the BGRT Josh Triplett
2014-07-30 19:23 ` Josh Triplett
2014-07-31 10:31 ` Matt Fleming
2014-07-31 10:31   ` Matt Fleming
2014-07-31 16:11   ` josh [this message]
2014-08-01  9:19     ` Matt Fleming
2014-08-01  9:19       ` Matt Fleming
     [not found]       ` <20140801091949.GD15082-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-08-01 16:11         ` Josh Triplett
2014-08-01 16:11           ` Josh Triplett
2014-08-04 12:19           ` Matt Fleming
     [not found]             ` <20140804121959.GG15082-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-08-05 16:39               ` Josh Triplett
2014-08-05 16:39                 ` Josh Triplett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140731161133.GA12663@cloud \
    --to=josh@joshtriplett.org \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux.bug.reporting@gmail.com \
    --cc=matt.fleming@intel.com \
    --cc=matt@console-pimps.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.