Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1466664

[PATCH 1/6] efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen

From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject [PATCH 1/6] efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen
Date 2016-08-19 22:40 +0200
Message-ID <s7YK5-1V6-3@gated-at.bofh.it> (permalink)
References <s7YK5-1V6-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jan Beulich <JBeulich@suse.com>

While commit 55f1ea15216 ("efi: Fix for_each_efi_memory_desc_in_map()
for empty memmaps") made an attempt to deal with empty memory maps, it
didn't address the case where the map field never gets set, as is
apparently the case when running under Xen.

Reported-by: <lists@ssl-mail.com>
Tested-by: <lists@ssl-mail.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Jan Beulich <jbeulich@suse.com>
[ Guard the loop with a NULL check instead of pointer underflow ]
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 include/linux/efi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/efi.h b/include/linux/efi.h
index 7f5a58225385..23cd3ced8c1a 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -946,7 +946,7 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm,
 /* Iterate through an efi_memory_map */
 #define for_each_efi_memory_desc_in_map(m, md)				   \
 	for ((md) = (m)->map;						   \
-	     ((void *)(md) + (m)->desc_size) <= (m)->map_end;		   \
+	     (md) && ((void *)(md) + (m)->desc_size) <= (m)->map_end;	   \
 	     (md) = (void *)(md) + (m)->desc_size)
 
 /**
-- 
2.7.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 0/6] EFI urgent fixes Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
  [PATCH 1/6] efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
  [PATCH 2/6] efi/libstub: Allocate headspace in efi_get_memory_map() Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
    Re: [PATCH 2/6] efi/libstub: Allocate headspace in  efi_get_memory_map() Ingo Molnar <mingo@kernel.org> - 2016-08-22 18:40 +0200
  [PATCH 6/6] efi/fdt: Fix handling error value in fdt_find_uefi_params Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
    Re: [PATCH 6/6] efi/fdt: Fix handling error value in  fdt_find_uefi_params Ingo Molnar <mingo@kernel.org> - 2016-08-22 18:50 +0200
  [PATCH 5/6] x86/efi: Use efi_exit_boot_services() Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
  [PATCH 4/6] efi/libstub: Use efi_exit_boot_services() in FDT Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
    Re: [PATCH 4/6] efi/libstub: Use efi_exit_boot_services() in FDT Ingo Molnar <mingo@kernel.org> - 2016-08-22 19:00 +0200
  [PATCH 3/6] efi/libstub: Introduce ExitBootServices helper Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-19 22:40 +0200
    Re: [PATCH 3/6] efi/libstub: Introduce ExitBootServices helper Ingo Molnar <mingo@kernel.org> - 2016-08-22 18:50 +0200

csiph-web