[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] Re: [PATCH] VirtioConsole support.
- To: Joe Perches <joe@xxxxxxxxxxx>
- From: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
- Date: Fri, 28 Oct 2011 11:19:40 -0700
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxx>, Miche Baker-Harvey <miche@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Anton Blanchard <anton@xxxxxxxxx>, Amit Shah <amit.shah@xxxxxxxxxx>
- Delivery-date: Mon, 14 Nov 2011 15:16:00 -0800
- List-id: Xen developer discussion <xen-devel.lists.xensource.com>
On 10/27/11 19:55, Joe Perches wrote:
>
> @@ -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.
Even better would be kmemdup().
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel