public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
To: Jan Beulich <JBeulich-IBi9RG/b67k@public.gmane.org>
Cc: Vitaly Kuznetsov
	<vkuznets-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Jiri Slaby <jslaby-AlSwsSmVLrQ@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Subject: Re: [PATCH v2] EFI: make for_each_efi_memory_desc_in_map() cope with running on Xen
Date: Tue, 16 Aug 2016 12:49:17 +0100	[thread overview]
Message-ID: <20160816114917.GM30909@codeblueprint.co.uk> (raw)
In-Reply-To: <57B1F6690200007800106095-rw/UEucdPrvD8XXLLHKrIiOjQekVJEpY@public.gmane.org>

On Mon, 15 Aug, at 09:05:45AM, Jan Beulich wrote:
> 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 desc_size field never gets set, as is
> apparently the case when running under Xen.
> 
> Reported-by: <lists-Ilq5uHa1fWNWk0Htik3J/w@public.gmane.org>
> Cc: Vitaly Kuznetsov <vkuznets-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Jiri Slaby <jslaby-AlSwsSmVLrQ@public.gmane.org>
> Signed-off-by: Jan Beulich <jbeulich-IBi9RG/b67k@public.gmane.org>
> Tested-by: <lists-Ilq5uHa1fWNWk0Htik3J/w@public.gmane.org>
> ---
> v2: Add comment.
> ---
>  include/linux/efi.h |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> --- 4.8-rc2/include/linux/efi.h
> +++ 4.8-rc2-EFI-memdesc-iterator-Xen/include/linux/efi.h
> @@ -946,7 +946,11 @@ extern int efi_memattr_apply_permissions
>  /* 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;		   \
> +	     /*								   \
> +	      * Leverage wrapping of the calculation to avoid an infinite  \
> +	      * loop when all three values are zero.			   \
> +	      */							   \
> +	     ((void *)(md) + (m)->desc_size - 1) < (m)->map_end;	   \
>  	     (md) = (void *)(md) + (m)->desc_size)
>  

Thanks Jan, applied to the 'urgent' EFI queue and tagged for stable.
I'll send it out this week.

  parent reply	other threads:[~2016-08-16 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 15:05 [PATCH v2] EFI: make for_each_efi_memory_desc_in_map() cope with running on Xen Jan Beulich
     [not found] ` <57B1F6690200007800106095-rw/UEucdPrvD8XXLLHKrIiOjQekVJEpY@public.gmane.org>
2016-08-16 11:49   ` Matt Fleming [this message]
     [not found]     ` <20160816114917.GM30909-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-08-19 10:47       ` Matt Fleming
     [not found]         ` <20160819104715.GR30909-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-08-19 12:07           ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160816114917.GM30909@codeblueprint.co.uk \
    --to=matt-mf/unelci9gs6ibeejttw/xrex20p6io@public.gmane.org \
    --cc=JBeulich-IBi9RG/b67k@public.gmane.org \
    --cc=jslaby-AlSwsSmVLrQ@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=vkuznets-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox