Linux-EFI Archive on lore.kernel.org
 help / color / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Arvind Sankar <nivedita@alum.mit.edu>
Cc: Ard Biesheuvel <ardb@kernel.org>, linux-efi <linux-efi@vger.kernel.org>
Subject: Re: [PATCH 1/2] efi/gop: Fix return value of setup_gop32/64
Date: Wed, 4 Dec 2019 15:28:30 +0000
Message-ID: <CAKv+Gu8LHeAM6wGS+abWPX9Mu4fkd_HBwP=XxzyvuzVZy01xLw@mail.gmail.com> (raw)
In-Reply-To: <20191204152348.GA626282@rani.riverdale.lan>

On Wed, 4 Dec 2019 at 15:23, Arvind Sankar <nivedita@alum.mit.edu> wrote:
>
> On Wed, Dec 04, 2019 at 03:03:04PM +0000, Ard Biesheuvel wrote:
> > On Tue, 3 Dec 2019 at 21:47, Arvind Sankar <nivedita@alum.mit.edu> wrote:
> > >
> > > There are two ways the status return of setup_gop32/64 could be
> > > incorrect.
> > >
> > > 1. If we don't find a usable GOP because none of them have a framebuffer
> > > (i.e. they were all PIXEL_BLT_ONLY), but all the efi calls succeeded, we
> > > will return EFI_SUCCESS even though we didn't find a usable GOP. Return
> > > EFI_NOT_FOUND instead, allowing the caller to probe for UGA instead.
> > >
> > > 2. If we do find a usable GOP, but one of the subsequent ones fails in
> > > an EFI call while checking if any support console output, we may return
> > > an EFI error code even though we found a usable GOP. Fix this by always
> > > returning EFI_SUCCESS if we got a usable GOP.
> > >
> >
> > Please split this into 2 patches
>
> Not quite following -- what should be the two pieces? Are you saying to
> split the success return and the failure return into two patches -- that
> seems excessively fine-grained.
>

Your commit log describes two distinct changes 1. and 2. The patch
addresses those two issues, and in addition, moves variable
declarations around. The result is much more difficult to read than
necessary.

> >
> > > Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
> > > ---
> > >  drivers/firmware/efi/libstub/gop.c | 16 ++++++++--------
> > >  1 file changed, 8 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c
> > > index 0101ca4c13b1..235a98797105 100644
> > > --- a/drivers/firmware/efi/libstub/gop.c
> > > +++ b/drivers/firmware/efi/libstub/gop.c
> > > @@ -119,7 +119,6 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >         u64 fb_base;
> > >         struct efi_pixel_bitmask pixel_info;
> > >         int pixel_format;
> > > -       efi_status_t status = EFI_NOT_FOUND;
> >
> > Is it really necessary to move this declaration?
>
> No, I just moved it inside the loop block since it's not used outside
> any more.
>
> >
> > >         u32 *handles = (u32 *)(unsigned long)gop_handle;
> > >         int i;
> > >
> > > @@ -134,6 +133,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >                 void *dummy = NULL;
> > >                 efi_handle_t h = (efi_handle_t)(unsigned long)handles[i];
> > >                 u64 current_fb_base;
> > > +               efi_status_t status;
> > >
> > >                 status = efi_call_early(handle_protocol, h,
> > >                                         proto, (void **)&gop32);
> > > @@ -175,7 +175,7 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >
> > >         /* Did we find any GOPs? */
> > >         if (!first_gop)
> > > -               goto out;
> > > +               return EFI_NOT_FOUND;
> > >
> > >         /* EFI framebuffer */
> > >         si->orig_video_isVGA = VIDEO_TYPE_EFI;
> > > @@ -197,8 +197,8 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >         si->lfb_size = si->lfb_linelength * si->lfb_height;
> > >
> > >         si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS;
> > > -out:
> > > -       return status;
> > > +
> > > +       return EFI_SUCCESS;
> > >  }
> > >
> > >  static efi_status_t
> > > @@ -237,7 +237,6 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >         u64 fb_base;
> > >         struct efi_pixel_bitmask pixel_info;
> > >         int pixel_format;
> > > -       efi_status_t status = EFI_NOT_FOUND;
> > >         u64 *handles = (u64 *)(unsigned long)gop_handle;
> > >         int i;
> > >
> > > @@ -252,6 +251,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >                 void *dummy = NULL;
> > >                 efi_handle_t h = (efi_handle_t)(unsigned long)handles[i];
> > >                 u64 current_fb_base;
> > > +               efi_status_t status;
> > >
> > >                 status = efi_call_early(handle_protocol, h,
> > >                                         proto, (void **)&gop64);
> > > @@ -293,7 +293,7 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >
> > >         /* Did we find any GOPs? */
> > >         if (!first_gop)
> > > -               goto out;
> > > +               return EFI_NOT_FOUND;
> > >
> > >         /* EFI framebuffer */
> > >         si->orig_video_isVGA = VIDEO_TYPE_EFI;
> > > @@ -315,8 +315,8 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si,
> > >         si->lfb_size = si->lfb_linelength * si->lfb_height;
> > >
> > >         si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS;
> > > -out:
> > > -       return status;
> > > +
> > > +       return EFI_SUCCESS;
> > >  }
> > >
> > >  /*
> > > --
> > > 2.23.0
> > >

  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 21:47 Arvind Sankar
2019-12-03 21:47 ` [PATCH 2/2] efi/gop: Fix memory leak in __gop_query32/64 Arvind Sankar
2019-12-04 15:11   ` Ard Biesheuvel
2019-12-04 15:27     ` Arvind Sankar
2019-12-04 15:30       ` Ard Biesheuvel
2019-12-04 15:44         ` Arvind Sankar
2019-12-04 15:03 ` [PATCH 1/2] efi/gop: Fix return value of setup_gop32/64 Ard Biesheuvel
2019-12-04 15:23   ` Arvind Sankar
2019-12-04 15:28     ` Ard Biesheuvel [this message]
2019-12-04 15:45       ` Arvind Sankar
2019-12-04 18:17 ` [PATCH v2 0/3] Fix a couple of bugs in efi/gop.c Arvind Sankar
2019-12-05 12:06   ` Ard Biesheuvel
2019-12-04 18:17 ` [PATCH v2 1/3] efi/gop: Return EFI_NOT_FOUND if there are no usable GOP's Arvind Sankar
2019-12-04 18:17 ` [PATCH v2 2/3] efi/gop: Return EFI_SUCCESS if a usable GOP was found Arvind Sankar
2019-12-04 18:17 ` [PATCH v2 3/3] efi/gop: Fix memory leak from __gop_query32/64 Arvind Sankar

Reply instructions:

You may reply publically 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='CAKv+Gu8LHeAM6wGS+abWPX9Mu4fkd_HBwP=XxzyvuzVZy01xLw@mail.gmail.com' \
    --to=ard.biesheuvel@linaro.org \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=nivedita@alum.mit.edu \
    /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

Linux-EFI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-efi/0 linux-efi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-efi linux-efi/ https://lore.kernel.org/linux-efi \
		linux-efi@vger.kernel.org
	public-inbox-index linux-efi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-efi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git