On Thu, Mar 12, 2015 at 4:36 PM, Tim Deegan <t...@xen.org> wrote:

> Hi,
>
> At 01:11 +0100 on 18 Feb (1424218301), Tamas K Lengyel wrote:
> > -int mem_paging_memop(struct domain *d, xen_mem_paging_op_t *mpo)
> > +int mem_paging_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_paging_op_t) arg)
> >  {
> > -    int rc = -ENODEV;
> > -    if ( unlikely(!d->vm_event->paging.ring_page) )
> > +    int rc;
> > +    xen_mem_paging_op_t mpo;
> > +    struct domain *d;
> > +    bool_t copyback = 0;
> > +
> > +    rc = -EFAULT;
> > +    if ( copy_from_guest(&mpo, arg, 1) )
> >          return rc;
>
> ISTR Jan suggested that you just 'return -EFAULT' here since you won't
> be reusing the rc.
>

Ack, already fixed in v7.


>
> > -    switch( mpo->op )
> > +    rc = rcu_lock_live_remote_domain_by_id(mpo.domain, &d);
> > +    if ( rc )
> > +        goto out;
>
> This one should be a return too; you only need the goto out if this
> succeeded.
>

Ack, also fixed in v7.


>
> > +    rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_paging_op);
> > +    if ( rc )
> > +        goto out;
> > +
> > +    rc = -ENODEV;
> > +    if ( unlikely(!d->vm_event->paging.ring_page) )
> > +        goto out;
> > +
> > +    switch( mpo.op )
> >      {
> >      case XENMEM_paging_op_nominate:
> > -        rc = p2m_mem_paging_nominate(d, mpo->gfn);
> > +        rc = p2m_mem_paging_nominate(d, mpo.gfn);
> >          break;
> >
> >      case XENMEM_paging_op_evict:
> > -        rc = p2m_mem_paging_evict(d, mpo->gfn);
> > +        rc = p2m_mem_paging_evict(d, mpo.gfn);
> >          break;
> >
> >      case XENMEM_paging_op_prep:
> > -        rc = p2m_mem_paging_prep(d, mpo->gfn, mpo->buffer);
> > +    {
>
> I don't think these braces are needed.
>

Ack.


>
> [...]
> >      /* Only HAP is supported */
> > +    rc = -ENODEV;
> >      if ( !hap_enabled(d) || !d->arch.hvm_domain.mem_sharing_enabled )
> > -         return -ENODEV;
> > +         rc = -ENODEV;
> >
>
> You need a 'goto out' here, or the rc gets overwritten immediately.
>

Ack, already fixed. I really need to get v7 posted =)


>
> Cheers,
>
> Tim.
>
> > -    switch(mec->op)
> > +    rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_sharing_op);
> > +    if ( rc )
> > +        goto out;
>
>
Thanks,
Tamas
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to