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

Re: [Xen-devel] [PATCH v4 1/8] public / x86: Introduce __HYPERCALL_dm_op...



On Fri, Jan 20, 2017 at 03:59:22PM +0000, Paul Durrant wrote:
> > -----Original Message-----
> [snip]
> > > +
> > > +    va_start(args, nr_bufs);
> > > +    for (idx = 0; idx < nr_bufs; idx++)
> > 
> > Coding style.
> 
> Ah, yes.
> 
> > 
> > > +
> > > +int compat_dm_op(domid_t domid,
> > > +                 unsigned int nr_bufs,
> > > +                 COMPAT_HANDLE_PARAM(compat_dm_op_buf_t) bufs)
> > > +{
> > > +    struct xen_dm_op_buf *nat;
> > > +    unsigned int i;
> > > +    int rc = -EFAULT;
> > > +
> > > +    nat = xzalloc_array(struct xen_dm_op_buf, nr_bufs);
> > > +    if ( !nat )
> > > +        return -ENOMEM;
> > > +
> > > +    for ( i = 0; i < nr_bufs; i++ )
> > > +    {
> > > +        struct compat_dm_op_buf cmp;
> > > +
> > > +        if ( copy_from_compat_offset(&cmp, bufs, i, 1) )
> > > +            goto out;
> > > +
> > > +#define XLAT_dm_op_buf_HNDL_h(_d_, _s_) \
> > > +        guest_from_compat_handle((_d_)->h, (_s_)->h)
> > > +
> > > +        XLAT_dm_op_buf(&nat[i], &cmp);
> > > +
> > > +#undef XLAT_dm_op_buf_HNDL_h
> > > +    }
> > > +
> > > +    rc = dm_op(domid, nr_bufs, nat);
> > > +
> > 
> > Need to copy back to the original places with copy_to_compat?
> > 
> 
> No. It's only the array itself that is subject to compat translation and that 
> is not copied back.
> 

Ah, you're right. The array contains only a bunch of guest handles so no
copy back is required.

Wei.

_______________________________________________
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®.