[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 2/5] efi/boot.c: add file.need_to_free


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 29 Sep 2020 13:06:57 +0200
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Trammell Hudson <hudson@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 29 Sep 2020 11:07:18 +0000
  • Ironport-sdr: eSdUnZIV3Xs0ym8BIxviFRvvVwmhcSsGG1GYxJYGyTjcOWXix59fvs0WvF1uMyAkAtbkdolluT 8nk8DBfzx3NnB1YX/Ym3lmjDL4rcikLUqZO8+QsKzRhpNm7fzmm8oEUQzhhDlC7r87OuWGC9uE jucTc4iVYI3MMq2QEKrbIJuu4sjdebHeSE4oxqar34xh8tGvQta3FpfnhBankbiodgpc5PYOdi 8oLpta0wh61FS6sibRQ0VuSC8jvzNqNo9Y1VutWSVX4m36hBmhuv8/SBaz4N1Bx2Zk3f3CxjTu HY8=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Sep 29, 2020 at 01:00:06PM +0200, Jan Beulich wrote:
> On 29.09.2020 12:45, Roger Pau Monné wrote:
> > On Mon, Sep 21, 2020 at 07:51:10AM -0400, Trammell Hudson wrote:
> >> --- a/xen/common/efi/boot.c
> >> +++ b/xen/common/efi/boot.c
> >> @@ -102,6 +102,7 @@ union string {
> >>  
> >>  struct file {
> >>      UINTN size;
> >> +    bool need_to_free;
> >>      union {
> >>          EFI_PHYSICAL_ADDRESS addr;
> >>          char *str;
> >> @@ -280,13 +281,13 @@ void __init noreturn blexit(const CHAR16 *str)
> >>      if ( !efi_bs )
> >>          efi_arch_halt();
> >>  
> >> -    if ( cfg.addr )
> >> +    if ( cfg.need_to_free )
> > 
> > If you drop the addr check here...
> > 
> >>          efi_bs->FreePages(cfg.addr, PFN_UP(cfg.size));
> >> -    if ( kernel.addr )
> >> +    if ( kernel.need_to_free )
> >>          efi_bs->FreePages(kernel.addr, PFN_UP(kernel.size));
> >> -    if ( ramdisk.addr )
> >> +    if ( ramdisk.need_to_free )
> >>          efi_bs->FreePages(ramdisk.addr, PFN_UP(ramdisk.size));
> >> -    if ( xsm.addr )
> >> +    if ( xsm.need_to_free )
> >>          efi_bs->FreePages(xsm.addr, PFN_UP(xsm.size));
> >>  
> >>      efi_arch_blexit();
> >> @@ -581,6 +582,7 @@ static bool __init read_file(EFI_FILE_HANDLE 
> >> dir_handle, CHAR16 *name,
> >>      }
> >>      else
> >>      {
> >> +        file->need_to_free = true;
> > 
> > ... I think you need to clear need_to_free if AllocatePages fails?
> 
> But this has been moved to the success path, or am I overlooking
> anything?

Oh yes, sorry, somehow I looked at the wrong context. Please ignore my
comment.

Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.