summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-12-25 14:57:45 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-12-25 14:57:45 +0100
commit84c8c3f22753c7d01bace23841bbe63b9179b3cd (patch)
treee401e5df72c77632fa6145afef86834201b83aab
parent70202c959b89f22df3d075e228263e1679383878 (diff)
downloadqemu-84c8c3f22753c7d01bace23841bbe63b9179b3cd.tar.gz
block/dmg: increase maximum image size to 64 GiB
The image length refers to the virtual image size, not the memory that gets allocated at runtime. An OS X installation image is already over 5 GiB and 64 MiB is far too low for this. Therefore bump it with a factor 1024 just to have enough room for future increases. DMG_SECTORCOUNTS_MAX will be compared against a uint64_t *sectorcounts and DMG_LENGTHS_MAX will be compared against uint64_t *lengths, so increasing the type size will not cause issues here. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--block/dmg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/dmg.c b/block/dmg.c
index 82d4b1aad0..6b08ff8767 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -32,7 +32,7 @@ enum {
/* Limit chunk sizes to prevent unreasonable amounts of memory being used
* or truncating when converting to 32-bit types
*/
- DMG_LENGTHS_MAX = 64 * 1024 * 1024, /* 64 MB */
+ DMG_LENGTHS_MAX = (uint64_t) 64 * 1024 * 1024 * 1024, /* 64 GiB */
DMG_SECTORCOUNTS_MAX = DMG_LENGTHS_MAX / 512,
};
@@ -221,7 +221,7 @@ static int dmg_read_mish_block(BDRVDMGState *s, DmgHeaderState *ds,
if (s->lengths[i] > DMG_LENGTHS_MAX) {
error_report("length %" PRIu64 " for chunk %" PRIu32
- " is larger than max (%u)",
+ " is larger than max (%" PRIu64 ")",
s->lengths[i], i, DMG_LENGTHS_MAX);
ret = -EINVAL;
goto fail;