diff mbox series

[v2,1/8] migration: Fix migrate_set_parameter

Message ID 20190403114958.3705-2-quintela@redhat.com (mailing list archive)
State New, archived
Headers show
Series WIP: Multifd compression support | expand

Commit Message

Juan Quintela April 3, 2019, 11:49 a.m. UTC
Otherwise we are setting err twice, what is wrong and causes an abort.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hmp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Dr. David Alan Gilbert April 3, 2019, 4:31 p.m. UTC | #1
* Juan Quintela (quintela@redhat.com) wrote:
> Otherwise we are setting err twice, what is wrong and causes an abort.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

This patch should be broken out as a separate fix.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 92941142af..8eec768088 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1825,8 +1825,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
>      case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE:
>          p->has_xbzrle_cache_size = true;
>          visit_type_size(v, param, &cache_size, &err);
> -        if (err || cache_size > INT64_MAX
> -            || (size_t)cache_size != cache_size) {
> +        if (err) {
> +            break;
> +        }
> +        if (cache_size > INT64_MAX || (size_t)cache_size != cache_size) {
>              error_setg(&err, "Invalid size %s", valuestr);
>              break;
>          }
> -- 
> 2.20.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
Dr. David Alan Gilbert April 5, 2019, 2:32 p.m. UTC | #2
* Juan Quintela (quintela@redhat.com) wrote:
> Otherwise we are setting err twice, what is wrong and causes an abort.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Queued just this one.

> ---
>  hmp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 92941142af..8eec768088 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1825,8 +1825,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
>      case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE:
>          p->has_xbzrle_cache_size = true;
>          visit_type_size(v, param, &cache_size, &err);
> -        if (err || cache_size > INT64_MAX
> -            || (size_t)cache_size != cache_size) {
> +        if (err) {
> +            break;
> +        }
> +        if (cache_size > INT64_MAX || (size_t)cache_size != cache_size) {
>              error_setg(&err, "Invalid size %s", valuestr);
>              break;
>          }
> -- 
> 2.20.1
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox series

Patch

diff --git a/hmp.c b/hmp.c
index 92941142af..8eec768088 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1825,8 +1825,10 @@  void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
     case MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE:
         p->has_xbzrle_cache_size = true;
         visit_type_size(v, param, &cache_size, &err);
-        if (err || cache_size > INT64_MAX
-            || (size_t)cache_size != cache_size) {
+        if (err) {
+            break;
+        }
+        if (cache_size > INT64_MAX || (size_t)cache_size != cache_size) {
             error_setg(&err, "Invalid size %s", valuestr);
             break;
         }