qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: John Snow <jsnow@redhat.com>, qemu-block@nongnu.org
Cc: famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH] nbd: avoid unaligned uint64_t store
Date: Thu, 4 Feb 2016 11:27:35 +0100	[thread overview]
Message-ID: <56B32797.3060808@redhat.com> (raw)
In-Reply-To: <1454543313-17505-1-git-send-email-jsnow@redhat.com>



On 04/02/2016 00:48, John Snow wrote:
> cpu_to_be64w can't be used to make unaligned stores, but stq_be_p can.
> The other stores in this routine are left alone, they're aligned already.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  nbd/server.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index 1ec79cf..5b65059 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -441,7 +441,7 @@ static coroutine_fn int nbd_negotiate(NBDClientNewData *data)
>          }
>  
>          assert ((client->exp->nbdflags & ~65535) == 0);
> -        cpu_to_be64w((uint64_t*)(buf + 18), client->exp->size);
> +        stq_be_p((uint64_t *)(buf + 18), client->exp->size);
>          cpu_to_be16w((uint16_t*)(buf + 26), client->exp->nbdflags | myflags);
>          if (nbd_negotiate_write(csock, buf + 18,
>                                  sizeof(buf) - 18) != sizeof(buf) - 18) {
> 

Let's change all of them.  But no need to send another patch.

Paolo

  reply	other threads:[~2016-02-04 10:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 23:48 [Qemu-devel] [PATCH] nbd: avoid unaligned uint64_t store John Snow
2016-02-04 10:27 ` Paolo Bonzini [this message]
2016-02-04 15:45   ` John Snow
2016-02-04 15:57     ` Paolo Bonzini

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=56B32797.3060808@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=mreitz@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).