qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v5 3/3] qcow2: add zstd cluster compression


From: Denis Plotnikov
Subject: Re: [Qemu-devel] [PATCH v5 3/3] qcow2: add zstd cluster compression
Date: Thu, 5 Sep 2019 14:52:37 +0000

On 05.09.2019 17:31, Eric Blake wrote:
> On 9/5/19 2:44 AM, Denis Plotnikov wrote:
>
>
>>>> +
>>>> +    s_size = be32_to_cpu(*(const uint32_t *) src);
>>> As written, this looks like you may be dereferencing an unaligned
>>> pointer.  It so happens that be32_to_cpu() applies & to your * to get
>>> back at the raw pointer, and then is careful to handle unaligned
>>> pointers, so it works; but it would look a lot nicer as merely:
>>>
>>> s_size = be32_to_cpu(src);
>> yes, but I can't use be32_to_cpu(*src) since src is a void pointer
> Then we need the correct ld*_p function; sorry for leading you down the
> wrong path.  Looks like the right one is:
>
> s_size = ldl_be_p(src)
>
> (include/qemu/bswap.h has some good comments, but you have to know they
> exist...)

No problem, that happens. By the way, I've already sent the series using 
ldl_be_p

Thanks!

Denis

>


reply via email to

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