mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Joe Perches <joe@perches.com>
Cc: Miche Baker-Harvey <miche@google.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
	Amit Shah <amit.shah@redhat.com>,
	Anton Blanchard <anton@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] VirtioConsole support.
Date: Fri, 28 Oct 2011 11:19:40 -0700	[thread overview]
Message-ID: <4EAAF23C.8050102@codeaurora.org> (raw)
In-Reply-To: <1319770558.2529.20.camel@Joe-Laptop>

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.


  reply	other threads:[~2011-10-28 18:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27  5:30 Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen Konrad Rzeszutek Wilk
2011-10-27  5:34 ` Konrad Rzeszutek Wilk
2011-10-27  5:48 ` Greg KH
     [not found]   ` <CAB8Rdaq2r4Uc-WZK-k=wiEW8DKdixn+9dB7E4_XDL7k8jCMwSw@mail.gmail.com>
2011-10-27 14:50     ` Fwd: " Miche Baker-Harvey
2011-10-27 15:08     ` Konrad Rzeszutek Wilk
2011-10-27 15:31       ` Konrad Rzeszutek Wilk
2011-10-27 17:22         ` Miche Baker-Harvey
2011-10-27 17:35           ` Konrad Rzeszutek Wilk
2011-10-27 18:39             ` [PATCH] VirtioConsole support Miche Baker-Harvey
2011-10-27 21:15               ` Konrad Rzeszutek Wilk
2011-10-31  9:55               ` Amit Shah
2011-10-27 21:43             ` Miche Baker-Harvey
2011-10-27 21:55               ` Konrad Rzeszutek Wilk
2011-10-28 16:27                 ` Greg KH
2011-10-28  2:55               ` Joe Perches
2011-10-28 18:19                 ` Stephen Boyd [this message]
2011-11-02 22:02                   ` Rusty Russell
2011-11-03 12:38                     ` Christian Borntraeger
2011-11-03 14:15                       ` Konrad Rzeszutek Wilk
2011-11-02  1:13   ` Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen Stephen Rothwell
2011-11-03  1:30     ` Greg KH
2011-11-07  6:19       ` Stephen Rothwell
2011-11-07 20:24         ` Greg KH
2011-10-31  7:48 ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EAAF23C.8050102@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=amit.shah@redhat.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=gregkh@suse.de \
    --cc=joe@perches.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miche@google.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome