Commit 57fea076 authored by Jan Beulich's avatar Jan Beulich Committed by Greg Kroah-Hartman

efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen

commit d4c4fed0 upstream.

While commit 55f1ea15 ("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>
Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
[ Guard the loop with a NULL check instead of pointer underflow ]
Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a8529888
...@@ -1005,7 +1005,7 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm, ...@@ -1005,7 +1005,7 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm,
/* Iterate through an efi_memory_map */ /* Iterate through an efi_memory_map */
#define for_each_efi_memory_desc_in_map(m, md) \ #define for_each_efi_memory_desc_in_map(m, md) \
for ((md) = (m)->map; \ 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) (md) = (void *)(md) + (m)->desc_size)
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment