All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] EFI: map allocation size must be set to zero
@ 2015-06-11 11:35 Jan Beulich
  2015-06-11 11:40 ` Ross Lagerwall
  2015-06-11 11:49 ` Ian Campbell
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2015-06-11 11:35 UTC (permalink / raw)
  To: xen-devel; +Cc: Ross Lagerwall

[-- Attachment #1: Type: text/plain, Size: 1793 bytes --]

Commit 8a753b3f1c ("efi: fix allocation problems if ExitBootServices()
fails") replaced the use of a static (and hence zero-initialized)
variable by an automatic (and hence uninitialized) one.

Also drop the variable introduced by that commit in favor of re-using
another available and suitable one.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -704,7 +704,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     EFI_STATUS status;
     unsigned int i, argc;
     CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
-    UINTN map_alloc_size, map_key, info_size, gop_mode = ~0;
+    UINTN map_key, info_size, gop_mode = ~0;
     EFI_HANDLE *handles = NULL;
     EFI_SHIM_LOCK_PROTOCOL *shim_lock;
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
@@ -1061,16 +1061,17 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
             efi_arch_video_init(gop, info_size, mode_info);
     }
 
-    efi_bs->GetMemoryMap(&map_alloc_size, NULL, &map_key,
+    info_size = 0;
+    efi_bs->GetMemoryMap(&info_size, NULL, &map_key,
                          &efi_mdesc_size, &mdesc_ver);
-    map_alloc_size += 8 * efi_mdesc_size;
-    efi_memmap = efi_arch_allocate_mmap_buffer(map_alloc_size);
+    info_size += 8 * efi_mdesc_size;
+    efi_memmap = efi_arch_allocate_mmap_buffer(info_size);
     if ( !efi_memmap )
         blexit(L"Unable to allocate memory for EFI memory map");
 
     for ( retry = 0; ; retry = 1 )
     {
-        efi_memmap_size = map_alloc_size;
+        efi_memmap_size = info_size;
         status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                       &efi_mdesc_size, &mdesc_ver);
         if ( EFI_ERROR(status) )




[-- Attachment #2: EFI-init-map-alloc-size.patch --]
[-- Type: text/plain, Size: 1835 bytes --]

EFI: map allocation size must be set to zero

Commit 8a753b3f1c ("efi: fix allocation problems if ExitBootServices()
fails") replaced the use of a static (and hence zero-initialized)
variable by an automatic (and hence uninitialized) one.

Also drop the variable introduced by that commit in favor of re-using
another available and suitable one.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -704,7 +704,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     EFI_STATUS status;
     unsigned int i, argc;
     CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
-    UINTN map_alloc_size, map_key, info_size, gop_mode = ~0;
+    UINTN map_key, info_size, gop_mode = ~0;
     EFI_HANDLE *handles = NULL;
     EFI_SHIM_LOCK_PROTOCOL *shim_lock;
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
@@ -1061,16 +1061,17 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
             efi_arch_video_init(gop, info_size, mode_info);
     }
 
-    efi_bs->GetMemoryMap(&map_alloc_size, NULL, &map_key,
+    info_size = 0;
+    efi_bs->GetMemoryMap(&info_size, NULL, &map_key,
                          &efi_mdesc_size, &mdesc_ver);
-    map_alloc_size += 8 * efi_mdesc_size;
-    efi_memmap = efi_arch_allocate_mmap_buffer(map_alloc_size);
+    info_size += 8 * efi_mdesc_size;
+    efi_memmap = efi_arch_allocate_mmap_buffer(info_size);
     if ( !efi_memmap )
         blexit(L"Unable to allocate memory for EFI memory map");
 
     for ( retry = 0; ; retry = 1 )
     {
-        efi_memmap_size = map_alloc_size;
+        efi_memmap_size = info_size;
         status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                       &efi_mdesc_size, &mdesc_ver);
         if ( EFI_ERROR(status) )

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] EFI: map allocation size must be set to zero
  2015-06-11 11:35 [PATCH] EFI: map allocation size must be set to zero Jan Beulich
@ 2015-06-11 11:40 ` Ross Lagerwall
  2015-06-11 11:49 ` Ian Campbell
  1 sibling, 0 replies; 3+ messages in thread
From: Ross Lagerwall @ 2015-06-11 11:40 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 06/11/2015 12:35 PM, Jan Beulich wrote:
> Commit 8a753b3f1c ("efi: fix allocation problems if ExitBootServices()
> fails") replaced the use of a static (and hence zero-initialized)
> variable by an automatic (and hence uninitialized) one.
>
> Also drop the variable introduced by that commit in favor of re-using
> another available and suitable one.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -704,7 +704,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>       EFI_STATUS status;
>       unsigned int i, argc;
>       CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
> -    UINTN map_alloc_size, map_key, info_size, gop_mode = ~0;
> +    UINTN map_key, info_size, gop_mode = ~0;
>       EFI_HANDLE *handles = NULL;
>       EFI_SHIM_LOCK_PROTOCOL *shim_lock;
>       EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
> @@ -1061,16 +1061,17 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>               efi_arch_video_init(gop, info_size, mode_info);
>       }
>
> -    efi_bs->GetMemoryMap(&map_alloc_size, NULL, &map_key,
> +    info_size = 0;
> +    efi_bs->GetMemoryMap(&info_size, NULL, &map_key,
>                            &efi_mdesc_size, &mdesc_ver);
> -    map_alloc_size += 8 * efi_mdesc_size;
> -    efi_memmap = efi_arch_allocate_mmap_buffer(map_alloc_size);
> +    info_size += 8 * efi_mdesc_size;
> +    efi_memmap = efi_arch_allocate_mmap_buffer(info_size);
>       if ( !efi_memmap )
>           blexit(L"Unable to allocate memory for EFI memory map");
>
>       for ( retry = 0; ; retry = 1 )
>       {
> -        efi_memmap_size = map_alloc_size;
> +        efi_memmap_size = info_size;
>           status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
>                                         &efi_mdesc_size, &mdesc_ver);
>           if ( EFI_ERROR(status) )
>
>
>

Acked-by: Ross Lagerwall <ross.lagerwall@citrix.com>

-- 
Ross Lagerwall

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] EFI: map allocation size must be set to zero
  2015-06-11 11:35 [PATCH] EFI: map allocation size must be set to zero Jan Beulich
  2015-06-11 11:40 ` Ross Lagerwall
@ 2015-06-11 11:49 ` Ian Campbell
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-06-11 11:49 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Ross Lagerwall

On Thu, 2015-06-11 at 12:35 +0100, Jan Beulich wrote:
> Commit 8a753b3f1c ("efi: fix allocation problems if ExitBootServices()
> fails") replaced the use of a static (and hence zero-initialized)
> variable by an automatic (and hence uninitialized) one.
> 
> Also drop the variable introduced by that commit in favor of re-using
> another available and suitable one.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> 
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -704,7 +704,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>      EFI_STATUS status;
>      unsigned int i, argc;
>      CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
> -    UINTN map_alloc_size, map_key, info_size, gop_mode = ~0;
> +    UINTN map_key, info_size, gop_mode = ~0;
>      EFI_HANDLE *handles = NULL;
>      EFI_SHIM_LOCK_PROTOCOL *shim_lock;
>      EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
> @@ -1061,16 +1061,17 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
>              efi_arch_video_init(gop, info_size, mode_info);
>      }
>  
> -    efi_bs->GetMemoryMap(&map_alloc_size, NULL, &map_key,
> +    info_size = 0;
> +    efi_bs->GetMemoryMap(&info_size, NULL, &map_key,
>                           &efi_mdesc_size, &mdesc_ver);
> -    map_alloc_size += 8 * efi_mdesc_size;
> -    efi_memmap = efi_arch_allocate_mmap_buffer(map_alloc_size);
> +    info_size += 8 * efi_mdesc_size;
> +    efi_memmap = efi_arch_allocate_mmap_buffer(info_size);
>      if ( !efi_memmap )
>          blexit(L"Unable to allocate memory for EFI memory map");
>  
>      for ( retry = 0; ; retry = 1 )
>      {
> -        efi_memmap_size = map_alloc_size;
> +        efi_memmap_size = info_size;
>          status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
>                                        &efi_mdesc_size, &mdesc_ver);
>          if ( EFI_ERROR(status) )
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-11 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11 11:35 [PATCH] EFI: map allocation size must be set to zero Jan Beulich
2015-06-11 11:40 ` Ross Lagerwall
2015-06-11 11:49 ` Ian Campbell

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.