[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 03.04.2020 00:43, Andrew Cooper wrote:
> 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.

Good point - in recent reviews I've commented to the same effect
on patches from Julien. This patch is way too old for me to have
recalled that I did like this here, too. Will switch (also
elsewhere in case I find more that I introduce).

Jan



 


Rackspace

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