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

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



>>> On 24.01.17 at 16:27, <paul.durrant@xxxxxxxxxx> wrote:
> +static bool copy_buf_from_guest(xen_dm_op_buf_t bufs[],
> +                                unsigned int nr_bufs, void *dst,
> +                                unsigned int idx, size_t dst_size)
> +{
> +    size_t size;
> +
> +    if ( idx >= nr_bufs )
> +        return false;
> +
> +    memset(dst, 0, dst_size);
> +
> +    size = min_t(size_t, dst_size, bufs[idx].size);
> +
> +    return !copy_from_guest(dst, bufs[idx].h, size);
> +}
> +
> +static bool copy_buf_to_guest(xen_dm_op_buf_t bufs[],
> +                              unsigned int nr_bufs, unsigned int idx,
> +                              void *src, size_t src_size)
> +{
> +    size_t size;
> +
> +    if ( idx >= nr_bufs )
> +        return false;
> +
> +    size = min_t(size_t, bufs[idx].size, src_size);
> +
> +    return !copy_to_guest(bufs[idx].h, src, size);
> +}

I'm sorry for noticing only now, but both functions would better
have their source sides constified.

> +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[MAX_NR_BUFS];
> +    unsigned int i;
> +
> +    if ( nr_bufs > MAX_NR_BUFS )
> +        return -EINVAL;

Well, I would still prefer E2BIG here. But neither adjustment is a
reason to further defer this series; both could be fixed up at the
committer's discretion.

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


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