qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH] nbd: avoid unaligned uint64_t store


From: Paolo Bonzini
Subject: Re: [Qemu-block] [PATCH] nbd: avoid unaligned uint64_t store
Date: Thu, 4 Feb 2016 11:27:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0


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 <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]