summary refs log tree commit diff stats
path: root/hw/ppc
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2020-10-26 13:40:47 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2020-10-28 01:08:53 +1100
commit0a06e4d6267ca150d62fbc371afab2fbb5586cb8 (patch)
treed048ac9766c0e3a278b646fa163c836f69da99ec /hw/ppc
parentc3e051ed6d2a0337fa5172d27231a193f18f92c4 (diff)
downloadfocaccia-qemu-0a06e4d6267ca150d62fbc371afab2fbb5586cb8.tar.gz
focaccia-qemu-0a06e4d6267ca150d62fbc371afab2fbb5586cb8.zip
target/ppc: Fix kvmppc_load_htab_chunk() error reporting
If kvmppc_load_htab_chunk() fails, its return value is propagated up
to vmstate_load(). It should thus be a negative errno, not -1 (which
maps to EPERM and would lure the user into thinking that the problem
is necessarily related to a lack of privilege).

Return the error reported by KVM or ENOSPC in case of short write.
While here, propagate the error message through an @errp argument
and have the caller to print it with error_report_err() instead
of relying on fprintf().

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160371604713.305923.5264900354159029580.stgit@bahia.lan>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index ba0894e73a..ec2536dba1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -2347,8 +2347,10 @@ static int htab_load(QEMUFile *f, void *opaque, int version_id)
 
             assert(fd >= 0);
 
-            rc = kvmppc_load_htab_chunk(f, fd, index, n_valid, n_invalid);
+            rc = kvmppc_load_htab_chunk(f, fd, index, n_valid, n_invalid,
+                                        &local_err);
             if (rc < 0) {
+                error_report_err(local_err);
                 return rc;
             }
         }