[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/5] x86/p2m: make p2m_remove_page()'s parameters type-safe



On 01/04/2020 12:39, Jan Beulich wrote:
> @@ -790,21 +789,23 @@ p2m_remove_page(struct p2m_domain *p2m,
>                                            &cur_order, NULL);
>  
>          if ( p2m_is_valid(t) &&
> -             (!mfn_valid(_mfn(mfn)) || mfn + i != mfn_x(mfn_return)) )
> +             (!mfn_valid(mfn) || !mfn_eq(mfn_add(mfn, i), mfn_return)) )
>              return -EILSEQ;
>  
> -        i += (1UL << cur_order) - ((gfn_l + i) & ((1UL << cur_order) - 1));
> +        i += (1UL << cur_order) -
> +             (gfn_x(gfn_add(gfn, i)) & ((1UL << cur_order) - 1));

We're gaining an number of expressions starting to look like this, but
honestly, "gfn_x(gfn) + i" is equally typesafe, shorter, and easier to
read IMO.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.