[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160905144237.2361-2-matt@codeblueprint.co.uk>
Date: Mon, 5 Sep 2016 15:42:32 +0100
From: Matt Fleming <matt@...eblueprint.co.uk>
To: Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
"H . Peter Anvin" <hpa@...or.com>
Cc: Jan Beulich <JBeulich@...e.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org,
Matt Fleming <matt@...eblueprint.co.uk>,
Jan Beulich <jbeulich@...e.com>, Jiri Slaby <jslaby@...e.cz>,
lists@...-mail.com, Mark Rutland <mark.rutland@....com>,
stable@...r.kernel.org, Vitaly Kuznetsov <vkuznets@...hat.com>
Subject: [PATCH 1/6] efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen
From: Jan Beulich <JBeulich@...e.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@...-mail.com>
Tested-by: <lists@...-mail.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: Jiri Slaby <jslaby@...e.cz>
Cc: Mark Rutland <mark.rutland@....com>
Cc: <stable@...r.kernel.org> # v4.7+
Signed-off-by: Jan Beulich <jbeulich@...e.com>
[ Guard the loop with a NULL check instead of pointer underflow ]
Signed-off-by: Matt Fleming <matt@...eblueprint.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.9.3
Powered by blists - more mailing lists