Skip to contentSkip to conversation

spapr: return from post_load method when RTC import fails

PATCH Applied Cédric Le Goater 3 participants 3 messages Jan 4, 2019 – Jan 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spapr: return from post_load method when RTC import fails

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")

---

Changes since v1 :

- Added Coverity issue CID

 hw/ppc/spapr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +7 -2
index f1725313e979..64397ee91ef0 100644
@@ -1748,12 +1748,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) {
Signature · 1 line
2.20.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · On Fri, 4 Jan 2019 14:30:50 +0100 Cédric Le Goater <[email protected]> wrote:

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")

---

Quoted 31 lines

Changes since v1 :

- Added Coverity issue CID

 hw/ppc/spapr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +7 -2
index f1725313e979..64397ee91ef0 100644
@@ -1748,12 +1748,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) {
Applied
#2 lore raw
In reply to Cédric Le Goater
Quoted 7 lines · Cédric Le Goater

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")

Applied to ppc-for-4.0, thanks.

Quoted 33 lines

---

Changes since v1 :

- Added Coverity issue CID

 hw/ppc/spapr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
hw/ppc/spapr.c +7 -2
index f1725313e979..64397ee91ef0 100644
@@ -1748,12 +1748,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) {
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson