WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] VirtioConsole support.

To: Miche Baker-Harvey <miche@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] VirtioConsole support.
From: Joe Perches <joe@xxxxxxxxxxx>
Date: Fri, 28 Oct 2011 05:55:58 +0300
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Anton, Greg Kroah-Hartman <gregkh@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Blanchard <anton@xxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Amit Shah <amit.shah@xxxxxxxxxx>
Delivery-date: Fri, 28 Oct 2011 08:36:04 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1319751802-27013-1-git-send-email-miche@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20111027173527.GA23839@xxxxxxxxxxxxxxxxxxx> <1319751802-27013-1-git-send-email-miche@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-10-27 at 14:43 -0700, Miche Baker-Harvey wrote:
> Multiple HVC console terminals enabled.

Just a note on allocation.

> diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
[]
> @@ -845,6 +857,19 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
>       kref_init(&hp->kref);
>  
>       INIT_WORK(&hp->tty_resize, hvc_set_winsz);
> +     /*
> +      * make each console its own struct console.
> +      * No need to do allocation and copy under lock.
> +      */
> +     cp = kzalloc(sizeof(*cp), GFP_KERNEL);
> +     if (!cp) {
> +             kfree(hp);
> +             mutex_unlock(&hvc_ports_mutex);
> +             return ERR_PTR(-ENOMEM);
> +     }
> +     memcpy(cp, &hvc_console, sizeof(*cp));

The kzalloc should be kmalloc as the allocated
memory is immediately overwritten.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel