spapr: return from post_load method when RTC import fails
authorCédric Le Goater <clg@kaod.org>
Fri, 4 Jan 2019 13:30:50 +0000 (14:30 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 8 Jan 2019 22:28:14 +0000 (09:28 +1100)
The error value can be squashed by the section handling radix migration.
Simply bail out if an error occurs when the RTC offset is imported.

This fixes the Coverity issue CID 1398591.

Fixes: d39c90f5f3ae ("spapr: Fix migration of Radix guests")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr.c

index 8576c1c6f7337fab796eb44e382f829fba670f65..59faeccf4bceee1f4f8729df760bb6f54092f3da 100644 (file)
@@ -1747,12 +1747,17 @@ static int spapr_post_load(void *opaque, int version_id)
         return err;
     }
 
-    /* In earlier versions, there was no separate qdev for the PAPR
+    /*
+     * In earlier versions, there was no separate qdev for the PAPR
      * RTC, so the RTC offset was stored directly in sPAPREnvironment.
      * So when migrating from those versions, poke the incoming offset
-     * value into the RTC device */
+     * value into the RTC device
+     */
     if (version_id < 3) {
         err = spapr_rtc_import_offset(&spapr->rtc, spapr->rtc_offset);
+        if (err) {
+            return err;
+        }
     }
 
     if (kvm_enabled() && spapr->patb_entry) {