All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	vsementsov@virtuozzo.com, qemu-block@nongnu.org,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH v3 1/4] nbd/server: Prefer heap over stack for parsing client names
Date: Wed, 13 Nov 2019 20:59:47 -0600	[thread overview]
Message-ID: <304af45f-673b-a481-7674-9cf4f35c9111@redhat.com> (raw)
In-Reply-To: <20191114024635.11363-2-eblake@redhat.com>

On 11/13/19 8:46 PM, Eric Blake wrote:
> As long as we limit NBD names to 256 bytes (the bare minimum permitted
> by the standard), stack-allocation works for parsing a name received
> from the client.  But as mentioned in a comment, we eventually want to
> permit up to the 4k maximum of the NBD standard, which is too large
> for stack allocation; so switch everything in the server to use heap
> allocation.  For now, there is no change in actually supported name
> length.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>   include/block/nbd.h | 10 +++++-----
>   nbd/server.c        | 25 +++++++++++++++----------
>   2 files changed, 20 insertions(+), 15 deletions(-)

> @@ -427,7 +431,7 @@ static void nbd_check_meta_export(NBDClient *client)
>   static int nbd_negotiate_handle_export_name(NBDClient *client, bool no_zeroes,
>                                               Error **errp)
>   {
> -    char name[NBD_MAX_NAME_SIZE + 1];
> +    g_autofree char *name;

This needs to be:

g_autofree char *name = NULL;

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2019-11-14  3:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14  2:46 [PATCH v3 for-4.2 0/4] Better NBD string length handling Eric Blake
2019-11-14  2:46 ` [PATCH v3 1/4] nbd/server: Prefer heap over stack for parsing client names Eric Blake
2019-11-14  2:59   ` Eric Blake [this message]
2019-11-14 10:04   ` Maxim Levitsky
2019-11-14 13:33     ` Eric Blake
2019-11-15 15:15       ` Maxim Levitsky
2019-11-15 14:59   ` Vladimir Sementsov-Ogievskiy
2019-11-14  2:46 ` [PATCH v3 2/4] bitmap: Enforce maximum bitmap name length Eric Blake
2019-11-14 10:04   ` Maxim Levitsky
2019-11-15 15:04   ` Vladimir Sementsov-Ogievskiy
2019-11-15 15:47     ` Vladimir Sementsov-Ogievskiy
2019-11-15 16:33       ` Eric Blake
2019-11-15 17:09         ` Vladimir Sementsov-Ogievskiy
2019-11-14  2:46 ` [PATCH v3 3/4] nbd: Don't send oversize strings Eric Blake
2019-11-14 10:04   ` Maxim Levitsky
2019-11-15 17:08   ` Vladimir Sementsov-Ogievskiy
2019-11-15 21:30     ` Eric Blake
2019-11-14  2:46 ` [PATCH v3 for-5.0 4/4] nbd: Allow description when creating NBD blockdev Eric Blake
2019-11-14  2:57 ` [PATCH v3 for-4.2 0/4] Better NBD string length handling no-reply
2019-11-14  3:00 ` no-reply
2019-11-14  3:04   ` Eric Blake

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=304af45f-673b-a481-7674-9cf4f35c9111@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.