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

Re: [Xen-devel] [PATCH v5 1/8] xen: move XENMAPSPACE_grant_table code into grant_table.c



On 08/09/17 16:49, Jan Beulich wrote:
>>>> On 08.09.17 at 08:56, <jgross@xxxxxxxx> wrote:
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -4631,40 +4631,19 @@ int xenmem_add_to_physmap_one(
>>  {
>>      struct page_info *page = NULL;
>>      unsigned long gfn = 0; /* gcc ... */
>> -    unsigned long prev_mfn, mfn = 0, old_gpfn;
>> +    unsigned long prev_mfn, old_gpfn;
>>      int rc = 0;
>> +    mfn_t mfn = INVALID_MFN;
>>      p2m_type_t p2mt;
>>  
>>      switch ( space )
>>      {
>>          case XENMAPSPACE_shared_info:
>>              if ( idx == 0 )
>> -                mfn = virt_to_mfn(d->shared_info);
>> +                mfn = _mfn(virt_to_mfn(d->shared_info));
>>              break;
>>          case XENMAPSPACE_grant_table:
>> -            grant_write_lock(d->grant_table);
>> -
>> -            if ( d->grant_table->gt_version == 0 )
>> -                d->grant_table->gt_version = 1;
>> -
>> -            if ( d->grant_table->gt_version == 2 &&
>> -                 (idx & XENMAPIDX_grant_table_status) )
>> -            {
>> -                idx &= ~XENMAPIDX_grant_table_status;
>> -                if ( idx < nr_status_frames(d->grant_table) )
>> -                    mfn = virt_to_mfn(d->grant_table->status[idx]);
>> -            }
>> -            else
>> -            {
>> -                if ( (idx >= nr_grant_frames(d->grant_table)) &&
>> -                     (idx < max_grant_frames) )
>> -                    gnttab_grow_table(d, idx + 1);
>> -
>> -                if ( idx < nr_grant_frames(d->grant_table) )
>> -                    mfn = virt_to_mfn(d->grant_table->shared_raw[idx]);
>> -            }
>> -
>> -            grant_write_unlock(d->grant_table);
>> +            gnttab_map_frame(d, idx, gpfn, &mfn);
> 
> You're ignoring a possible error here. Of course right now this can
> only come together with mfn staying INVALID_MFN, but if any
> further change to the function happened this may change without
> the author noticing that the error check here is missing.

Okay, I'll test for error here.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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