* [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check
@ 2013-09-30 6:59 Max Reitz
2013-09-30 8:06 ` Kevin Wolf
2013-10-02 9:06 ` Stefan Hajnoczi
0 siblings, 2 replies; 4+ messages in thread
From: Max Reitz @ 2013-09-30 6:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, Stefan Hajnoczi, Max Reitz
If an inactive L1 table is loaded from disk, its entries are in big
endian and have to be converted to host byte order before using them.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/qcow2-refcount.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index d2b7064..364eeba 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -1733,8 +1733,8 @@ int qcow2_check_metadata_overlap(BlockDriverState *bs, int chk, int64_t offset,
}
for (j = 0; j < l1_sz; j++) {
- if ((l1[j] & L1E_OFFSET_MASK) &&
- overlaps_with(l1[j] & L1E_OFFSET_MASK, s->cluster_size)) {
+ uint64_t l2_ofs = be64_to_cpu(l1[j]) & L1E_OFFSET_MASK;
+ if (l2_ofs && overlaps_with(l2_ofs, s->cluster_size)) {
g_free(l1);
return QCOW2_OL_INACTIVE_L2;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check
2013-09-30 6:59 [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check Max Reitz
@ 2013-09-30 8:06 ` Kevin Wolf
2013-09-30 8:07 ` Max Reitz
2013-10-02 9:06 ` Stefan Hajnoczi
1 sibling, 1 reply; 4+ messages in thread
From: Kevin Wolf @ 2013-09-30 8:06 UTC (permalink / raw)
To: Max Reitz; +Cc: qemu-devel, Stefan Hajnoczi
Am 30.09.2013 um 08:59 hat Max Reitz geschrieben:
> If an inactive L1 table is loaded from disk, its entries are in big
> endian and have to be converted to host byte order before using them.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Sounds like there's yet a test case missing? (But it requires the
runtime options for enabling these checks, obviously)
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check
2013-09-30 8:06 ` Kevin Wolf
@ 2013-09-30 8:07 ` Max Reitz
0 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2013-09-30 8:07 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, Stefan Hajnoczi
On 2013-09-30 10:06, Kevin Wolf wrote:
> Am 30.09.2013 um 08:59 hat Max Reitz geschrieben:
>> If an inactive L1 table is loaded from disk, its entries are in big
>> endian and have to be converted to host byte order before using them.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
>
> Sounds like there's yet a test case missing? (But it requires the
> runtime options for enabling these checks, obviously)
Yes to both. For now, I just couldn't write such a test case.
Max
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check
2013-09-30 6:59 [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check Max Reitz
2013-09-30 8:06 ` Kevin Wolf
@ 2013-10-02 9:06 ` Stefan Hajnoczi
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2013-10-02 9:06 UTC (permalink / raw)
To: Max Reitz; +Cc: Kevin Wolf, qemu-devel
On Mon, Sep 30, 2013 at 08:59:28AM +0200, Max Reitz wrote:
> If an inactive L1 table is loaded from disk, its entries are in big
> endian and have to be converted to host byte order before using them.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block/qcow2-refcount.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-02 9:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 6:59 [Qemu-devel] [PATCH] qcow2: Correct endianness in overlap check Max Reitz
2013-09-30 8:06 ` Kevin Wolf
2013-09-30 8:07 ` Max Reitz
2013-10-02 9:06 ` Stefan Hajnoczi
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).