From: Eric Blake <eblake@redhat.com>
To: Denis Plotnikov <dplotnikov@virtuozzo.com>,
"armbru@redhat.com" <armbru@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Denis Lunev <den@virtuozzo.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"mreitz@redhat.com" <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 3/3] qcow2: add zstd cluster compression
Date: Thu, 5 Sep 2019 09:31:24 -0500 [thread overview]
Message-ID: <829a32ee-0a5a-7bc6-e696-d3315ec53c13@redhat.com> (raw)
In-Reply-To: <1feb49e1-bab1-ac10-3232-95d696995b96@virtuozzo.com>
[-- Attachment #1.1: Type: text/plain, Size: 863 bytes --]
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...)
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-09-05 14:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 15:29 [Qemu-devel] [PATCH v5 0/3] qcow2: add zstd cluster compression Denis Plotnikov
2019-09-04 15:29 ` [Qemu-devel] [PATCH v5 1/3] qcow2: introduce compression type feature Denis Plotnikov
2019-09-04 15:42 ` Eric Blake
2019-09-04 15:29 ` [Qemu-devel] [PATCH v5 2/3] qcow2: rework the cluster compression routine Denis Plotnikov
2019-09-04 15:46 ` Eric Blake
2019-09-04 15:46 ` Eric Blake
2019-09-04 15:29 ` [Qemu-devel] [PATCH v5 3/3] qcow2: add zstd cluster compression Denis Plotnikov
2019-09-04 16:07 ` Eric Blake
2019-09-05 7:44 ` Denis Plotnikov
2019-09-05 14:31 ` Eric Blake [this message]
2019-09-05 14:52 ` Denis Plotnikov
2019-09-05 8:52 ` Denis Plotnikov
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=829a32ee-0a5a-7bc6-e696-d3315ec53c13@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=den@virtuozzo.com \
--cc=dplotnikov@virtuozzo.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/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).