qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 06/14] nbd: Send message along with server NBD_REP_ERR errors
Date: Mon, 27 Jun 2016 14:02:10 +0200	[thread overview]
Message-ID: <f431e31f-50dc-8ef3-3ff5-94d4149d5276@redhat.com> (raw)
In-Reply-To: <1466892954-8684-7-git-send-email-eblake@redhat.com>



On 26/06/2016 00:15, Eric Blake wrote:
> 
> +/* Send an error reply.
> + * Return -errno to kill connection, 0 to continue negotiation. */
> +static int GCC_FMT_ATTR(4, 5)
> +    nbd_negotiate_send_rep_err(QIOChannel *ioc, uint32_t type,
> +                               uint32_t opt, const char *fmt, ...)
> +{
> +    va_list va;
> +    char *msg;
> +    int ret;
> +    size_t len;
> +
> +    va_start(va, fmt);
> +    msg = g_strdup_vprintf(fmt, va);

This leaks below.

Paolo

> +    va_end(va);
> +    len = strlen(msg);
> +    assert(len < 4096);
> +    TRACE("sending error message \"%s\"", msg);
> +    ret = nbd_negotiate_send_rep_len(ioc, type, opt, len);
> +    if (ret < 0) {
> +        return ret;
> +    }
> +    if (nbd_negotiate_write(ioc, msg, len) != len) {
> +        LOG("write failed (error message)");
> +        return -EINVAL;
> +    }
> +    return 0;

  reply	other threads:[~2016-06-27 12:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-25 22:15 [Qemu-devel] [PATCH v4 00/14] nbd: efficient write zeroes Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 01/14] nbd: Fix bad flag detection on server Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 02/14] nbd: Add qemu-nbd -D for human-readable description Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 03/14] nbd: Limit nbdflags to 16 bits Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 04/14] nbd: Treat flags vs. command type as separate fields Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 05/14] nbd: Share common reply-sending code in server Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 06/14] nbd: Send message along with server NBD_REP_ERR errors Eric Blake
2016-06-27 12:02   ` Paolo Bonzini [this message]
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 07/14] nbd: Share common option-sending code in client Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 08/14] nbd: Let server know when client gives up negotiation Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 09/14] nbd: Let client skip portions of server reply Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 10/14] nbd: Less allocation during NBD_OPT_LIST Eric Blake
2016-06-27 12:16   ` Paolo Bonzini
2016-07-18 23:31     ` Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 11/14] nbd: Support shorter handshake Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 12/14] nbd: Improve server handling of shutdown requests Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 13/14] nbd: Implement NBD_CMD_WRITE_ZEROES on server Eric Blake
2016-06-25 22:15 ` [Qemu-devel] [PATCH v4 14/14] nbd: Implement NBD_CMD_WRITE_ZEROES on client Eric Blake
2016-06-27 12:13   ` Paolo Bonzini
2016-06-27 13:00     ` 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=f431e31f-50dc-8ef3-3ff5-94d4149d5276@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).