On 06/11/2015 01:24, Andrew Jones wrote:
> This is a fix just due to being too much of a type-A person.
> I noticed the issue while reading over the function, and
> decided to fix it, even though it's unlikely to be a problem
> ever because top is read-mostly (like written once, then only
> read, type of mostly).
> 
> Signed-off-by: Andrew Jones <drjo...@redhat.com>
> ---
>  lib/alloc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/alloc.c b/lib/alloc.c
> index ad6761430c965..34f71a337d868 100644
> --- a/lib/alloc.c
> +++ b/lib/alloc.c
> @@ -61,15 +61,17 @@ static phys_addr_t phys_alloc_aligned_safe(phys_addr_t 
> size,
>  {
>       static bool warned = false;
>       phys_addr_t addr, size_orig = size;
> -     u64 top_safe = top;
> +     u64 top_safe;
> +
> +     spin_lock(&lock);
> +
> +     top_safe = top;
>  
>       if (safe && sizeof(long) == 4)
>               top_safe = MIN(top, 1ULL << 32);
>  
>       align = MAX(align, align_min);
>  
> -     spin_lock(&lock);
> -
>       addr = ALIGN(base, align);
>       size += addr - base;
>  
> 

Applied, thanks.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to