[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v12] introduce XENMEM_reserved_device_memory_map
>>> On 22.07.15 at 14:55, <tiejun.chen@xxxxxxxxx> wrote: >> +#ifdef HAS_PASSTHROUGH >> + case XENMEM_reserved_device_memory_map: >> + { >> + struct get_reserved_device_memory grdm; >> + >> + if ( unlikely(start_extent) ) >> + return -ENOSYS; >> + >> + if ( copy_from_guest(&grdm.map, compat, 1) || >> + !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) > ) >> + return -EFAULT; >> + >> + if ( grdm.map.flags & ~XENMEM_RDM_ALL ) >> + return -EINVAL; >> + >> + grdm.used_entries = 0; >> + rc = >> iommu_get_reserved_device_memory(get_reserved_device_memory, >> + &grdm); >> + > > Just as you asked me previously, > > Here if RDM doesn't exist, so > > grdm.map.nr_entries = grdm.used_entries = 0, and rc = 0, right? No, grdm.map.nr_entries still holds whatever the caller passed. >> + if ( !rc && grdm.map.nr_entries < grdm.used_entries ) >> + rc = -ENOBUFS; >> + grdm.map.nr_entries = grdm.used_entries; >> + if ( __copy_to_guest(compat, &grdm.map, 1) ) > > So can we still do this copy here? We not only can, we need to. The only case where we might skip it is when the incoming grdm.map.nr_entries is unchanged. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |