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