aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorOrit Wasserman <owasserm@redhat.com>2014-01-30 20:08:34 +0200
committerJuan Quintela <quintela@redhat.com>2014-02-04 16:49:24 +0100
commitc91e681a558fc21073ffc491b5a022d5f340fa0b (patch)
treed0ebb8ac354ddb77fcd75a4ce99397d5be315a89 /migration.c
parentf6c6483b259a2395ee44cfa966f622e0f2dbe2ae (diff)
downloadqemu-c91e681a558fc21073ffc491b5a022d5f340fa0b.zip
qemu-c91e681a558fc21073ffc491b5a022d5f340fa0b.tar.gz
qemu-c91e681a558fc21073ffc491b5a022d5f340fa0b.tar.bz2
Add check for cache size smaller than page size
Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/migration.c b/migration.c
index 7235c23..84587e9 100644
--- a/migration.c
+++ b/migration.c
@@ -469,6 +469,7 @@ void qmp_migrate_cancel(Error **errp)
void qmp_migrate_set_cache_size(int64_t value, Error **errp)
{
MigrationState *s = migrate_get_current();
+ int64_t new_size;
/* Check for truncation */
if (value != (size_t)value) {
@@ -477,7 +478,14 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
return;
}
- s->xbzrle_cache_size = xbzrle_cache_resize(value);
+ new_size = xbzrle_cache_resize(value);
+ if (new_size < 0) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
+ "is smaller than page size");
+ return;
+ }
+
+ s->xbzrle_cache_size = new_size;
}
int64_t qmp_query_migrate_cache_size(Error **errp)