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

Re: [Xen-devel] [PATCH 06/27 v9] xen/arm: vpl011: Add a new domctl API to initialize vpl011



On Mon, Sep 18, 2017 at 04:01:50PM +0530, Bhupinder Thakur wrote:
>  
> +int libxl__arch_build_dom_finish(libxl__gc *gc,
> +                                 libxl_domain_build_info *info,
> +                                 struct xc_dom_image *dom,
> +                                 libxl__domain_build_state *state)
> +{
> +    int rc, ret;
> +
> +    if (info->arch_arm.vuart != LIBXL_VUART_TYPE_SBSA_UART) {
> +        rc = 0;
> +        goto out;
> +    }
> +
> +    ret = xc_dom_vuart_init(CTX->xch,
> +                            XEN_DOMCTL_VUART_TYPE_VPL011,
> +                            dom->guest_domid,
> +                            dom->console_domid,
> +                            dom->vuart_gfn,
> +                            &state->vuart_port);
> +    if (ret < 0) {
> +        rc = ERROR_FAIL;
> +        LOG(ERROR, "xc_dom_vuart_init failed\n");
> +    }
> +
> +out:
> +    return rc;

rc is uninitialised in this function, which you already noticed.

>  {
> @@ -119,6 +144,33 @@ long arch_do_domctl(struct xen_domctl *domctl, struct 
> domain *d,
>          d->disable_migrate = domctl->u.disable_migrate.disable;
>          return 0;
>  
> +    case XEN_DOMCTL_vuart_op:
> +    {
> +        int rc;
> +        unsigned int i;
> +        struct xen_domctl_vuart_op *vuart_op = &domctl->u.vuart_op;
> +
> +        /* check that structure padding must be 0. */
> +        for ( i = 0; i < sizeof(vuart_op->pad); i++ )
> +            if ( vuart_op->pad[i] )
> +                return -EINVAL;
> +
> +        switch( vuart_op->cmd )
> +        {
> +        case XEN_DOMCTL_VUART_OP_INIT:
> +            rc = handle_vuart_init(d, vuart_op);
> +            break;
> +
> +        default:
> +            rc = -EINVAL;
> +            break;
> +        }
> +
> +        if ( !rc )
> +            rc = __copy_to_guest(u_domctl, domctl, 1);

Please use the non-underscored variant which has more checks.

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