[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4F044D10020000780006A5B4@nat28.tlf.novell.com>
Date: Wed, 04 Jan 2012 11:58:56 +0000
From: "Jan Beulich" <JBeulich@...e.com>
To: "Ian Campbell" <ian.campbell@...rix.com>
Cc: "Haogang Chen" <haogangchen@...il.com>,
"Jeremy Fitzhardinge" <jeremy@...p.org>,
<virtualization@...ts.linux-foundation.org>,
<xen-devel@...ts.xensource.com>,
"Konrad Rzeszutek Wilk" <konrad.wilk@...cle.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [Xen-devel] [PATCH 2/2] xen/xenbus: don't reimplement
kvasprintf via a fixed size buffer
>>> On 04.01.12 at 12:39, Ian Campbell <ian.campbell@...rix.com> wrote:
> Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
Acked-by: Jan Beulich <jbeulich@...e.com>
> Cc: Haogang Chen <haogangchen@...il.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Cc: Jeremy Fitzhardinge <jeremy@...p.org>
> Cc: xen-devel@...ts.xensource.com
> Cc: virtualization@...ts.linux-foundation.org
> Cc: linux-kernel@...r.kernel.org
> ---
> drivers/xen/xenbus/xenbus_xs.c | 17 +++++++----------
> 1 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
> index 6f0121e..226d1ac 100644
> --- a/drivers/xen/xenbus/xenbus_xs.c
> +++ b/drivers/xen/xenbus/xenbus_xs.c
> @@ -532,21 +532,18 @@ int xenbus_printf(struct xenbus_transaction t,
> {
> va_list ap;
> int ret;
> -#define PRINTF_BUFFER_SIZE 4096
> - char *printf_buffer;
> -
> - printf_buffer = kmalloc(PRINTF_BUFFER_SIZE, GFP_NOIO | __GFP_HIGH);
> - if (printf_buffer == NULL)
> - return -ENOMEM;
> + char *buf;
>
> va_start(ap, fmt);
> - ret = vsnprintf(printf_buffer, PRINTF_BUFFER_SIZE, fmt, ap);
> + buf = kvasprintf(GFP_NOIO | __GFP_HIGH, fmt, ap);
> va_end(ap);
>
> - BUG_ON(ret > PRINTF_BUFFER_SIZE-1);
> - ret = xenbus_write(t, dir, node, printf_buffer);
> + if (!buf)
> + return -ENOMEM;
> +
> + ret = xenbus_write(t, dir, node, buf);
>
> - kfree(printf_buffer);
> + kfree(buf);
>
> return ret;
> }
> --
> 1.7.2.5
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@...ts.xensource.com
> http://lists.xensource.com/xen-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists